Merge pull request #11638 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rails-2.11.2

This commit is contained in:
Nanda H Krishna 2021-07-02 01:50:50 +05:30 committed by GitHub
commit e20ec394b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
109 changed files with 15 additions and 6 deletions

View File

@ -126,7 +126,7 @@ GEM
rubocop-performance (1.11.3)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.11.1)
rubocop-rails (2.11.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)

View File

@ -655,6 +655,7 @@ class RuboCop::Cop::Rails::FindBy < ::RuboCop::Cop::Base
def autocorrect(corrector, node); end
def ignore_where_first?; end
def offense_range(node); end
def where_method?(receiver); end
end

View File

@ -83,7 +83,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.17.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.11.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.11.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib"

View File

@ -194,7 +194,11 @@ module RuboCop
def database_yaml
return nil unless File.exist?('config/database.yml')
yaml = YAML.load_file('config/database.yml')
yaml = if YAML.respond_to?(:unsafe_load_file)
YAML.unsafe_load_file('config/database.yml')
else
YAML.load_file('config/database.yml')
end
return nil unless yaml.is_a? Hash
config = yaml['development']

View File

@ -32,10 +32,10 @@ module RuboCop
RESTRICT_ON_SEND = %i[first take].freeze
def on_send(node)
return unless where_method?(node.receiver)
return unless node.arguments.empty? && where_method?(node.receiver)
return if ignore_where_first? && node.method?(:first)
range = range_between(node.receiver.loc.selector.begin_pos, node.loc.selector.end_pos)
range = offense_range(node)
add_offense(range, message: format(MSG, method: node.method_name)) do |corrector|
autocorrect(corrector, node)
@ -51,6 +51,10 @@ module RuboCop
receiver.respond_to?(:method?) && receiver.method?(:where)
end
def offense_range(node)
range_between(node.receiver.loc.selector.begin_pos, node.loc.selector.end_pos)
end
def autocorrect(corrector, node)
return if node.method?(:first)

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