brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2021-12-09 18:08:24 +00:00
parent 7481f40ffb
commit 711c45ca91
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
35 changed files with 67 additions and 49 deletions

View File

@ -90,7 +90,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.23.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.12.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.12.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.6.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov_json_formatter-0.1.3/lib"

View File

@ -1,47 +0,0 @@
# frozen_string_literal: true
module RuboCop
module Cop
module Sorbet
# This cop makes sure that RBI files are always located under the defined allowed paths.
#
# Options:
#
# * `AllowedPaths`: A list of the paths where RBI files are allowed (default: ["sorbet/rbi/**"])
#
# @example
# # bad
# # lib/some_file.rbi
# # other_file.rbi
#
# # good
# # sorbet/rbi/some_file.rbi
# # sorbet/rbi/any/path/for/file.rbi
class ForbidRBIOutsideOfAllowedPaths < RuboCop::Cop::Cop
include RangeHelp
def investigate(processed_source)
add_offense(
nil,
location: source_range(processed_source.buffer, 1, 0),
message: message
) if allowed_paths.none? { |pattern| File.fnmatch(pattern, processed_source.file_path) }
end
private
def allowed_paths
cop_config["AllowedPaths"]&.compact || []
end
def message
if allowed_paths.empty?
"RBI files should be located in an allowed path, but AllowedPaths is empty or nil"
else
"RBI file path should match one of: #{allowed_paths.join(", ")}"
end
end
end
end
end
end

View File

@ -0,0 +1,65 @@
# frozen_string_literal: true
require "pathname"
module RuboCop
module Cop
module Sorbet
# This cop makes sure that RBI files are always located under the defined allowed paths.
#
# Options:
#
# * `AllowedPaths`: A list of the paths where RBI files are allowed (default: ["sorbet/rbi/**"])
#
# @example
# # bad
# # lib/some_file.rbi
# # other_file.rbi
#
# # good
# # sorbet/rbi/some_file.rbi
# # sorbet/rbi/any/path/for/file.rbi
class ForbidRBIOutsideOfAllowedPaths < RuboCop::Cop::Cop
include RangeHelp
def investigate(processed_source)
paths = allowed_paths
if paths.nil?
add_offense(
nil,
location: source_range(processed_source.buffer, 1, 0),
message: "AllowedPaths expects an array"
)
return
elsif paths.empty?
add_offense(
nil,
location: source_range(processed_source.buffer, 1, 0),
message: "AllowedPaths cannot be empty"
)
return
end
# When executed the path to the source file is absolute.
# We need to remove the exec path directory prefix before matching with the filename regular expressions.
rel_path = processed_source.file_path.sub("#{Dir.pwd}/", "")
add_offense(
nil,
location: source_range(processed_source.buffer, 1, 0),
message: "RBI file path should match one of: #{paths.join(", ")}"
) if paths.none? { |pattern| File.fnmatch(pattern, rel_path) }
end
private
def allowed_paths
paths = cop_config["AllowedPaths"]
return nil unless paths.is_a?(Array)
paths.compact
end
end
end
end
end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
module RuboCop
module Sorbet
VERSION = "0.6.3"
VERSION = "0.6.4"
end
end