brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2020-12-18 17:02:57 +00:00
parent df9082cab5
commit 019dd9fbec
110 changed files with 55 additions and 18 deletions

View File

@ -79,7 +79,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.5.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.9.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.0.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.1.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.5.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-stub-0.2.0/lib"

View File

@ -328,6 +328,7 @@ RSpec/Focus:
Description: Checks if examples are focused.
Enabled: true
VersionAdded: '1.5'
VersionChanged: '2.1'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
RSpec/HookArgument:

View File

@ -82,30 +82,39 @@ module RuboCop
private
def ensure_correct_file_path(send_node, described_class, arguments)
glob = glob_for(described_class, arguments.first)
return if filename_ends_with?(glob)
pattern = pattern_for(described_class, arguments.first)
return if filename_ends_with?(pattern)
add_offense(send_node, message: format(MSG, suffix: glob))
# For the suffix shown in the offense message, modify the regular
# expression pattern to resemble a glob pattern for clearer error
# messages.
offense_suffix = pattern.gsub('.*', '*').sub('[^/]', '')
.sub('\.', '.')
add_offense(send_node, message: format(MSG, suffix: offense_suffix))
end
def routing_spec?(args)
args.any?(&method(:routing_metadata?))
end
def glob_for(described_class, method_name)
return glob_for_spec_suffix_only? if spec_suffix_only?
def pattern_for(described_class, method_name)
return pattern_for_spec_suffix_only? if spec_suffix_only?
"#{expected_path(described_class)}#{name_glob(method_name)}*_spec.rb"
[
expected_path(described_class),
name_pattern(method_name),
'[^/]*_spec\.rb'
].join
end
def glob_for_spec_suffix_only?
'*_spec.rb'
def pattern_for_spec_suffix_only?
'.*_spec\.rb'
end
def name_glob(method_name)
def name_pattern(method_name)
return unless method_name&.str_type?
"*#{method_name.str_content.gsub(/\W/, '')}" unless ignore_methods?
".*#{method_name.str_content.gsub(/\W/, '')}" unless ignore_methods?
end
def expected_path(constant)
@ -131,11 +140,9 @@ module RuboCop
cop_config['IgnoreMethods']
end
def filename_ends_with?(glob)
filename =
RuboCop::PathUtil.relative_path(processed_source.buffer.name)
.gsub('../', '')
File.fnmatch?("*#{glob}", filename)
def filename_ends_with?(pattern)
filename = File.expand_path(processed_source.buffer.name)
filename.match?("#{pattern}$")
end
def relevant_rubocop_rspec_file?(_file)

View File

@ -20,6 +20,9 @@ module RuboCop
# describe MyClass do
# end
class Focus < Base
extend AutoCorrector
include RangeHelp
MSG = 'Focused spec found.'
def_node_matcher :focusable_selector?, <<-PATTERN
@ -44,7 +47,13 @@ module RuboCop
def on_send(node)
focus_metadata(node) do |focus|
add_offense(focus)
add_offense(focus) do |corrector|
if focus.pair_type? || focus.str_type? || focus.sym_type?
corrector.remove(with_surrounding(focus))
elsif focus.send_type?
correct_send(corrector, focus)
end
end
end
end
@ -55,6 +64,26 @@ module RuboCop
metadata(node, &block)
end
def with_surrounding(focus)
range_with_space = range_with_surrounding_space(
range: focus.loc.expression,
side: :left
)
range_with_surrounding_comma(range_with_space, :left)
end
def correct_send(corrector, focus)
range = focus.loc.selector
unfocused = focus.method_name.to_s.sub(/^f/, '')
unless Examples.regular(unfocused) || ExampleGroups.regular(unfocused)
return
end
corrector.replace(range,
range.source.sub(focus.method_name.to_s, unfocused))
end
end
end
end

Some files were not shown because too many files have changed in this diff Show More