Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for Rails/RedundantActiveRecordAllMethod cop in 2.21.0 #1109

Closed
gotchin opened this issue Sep 11, 2023 · 0 comments
Closed

Error for Rails/RedundantActiveRecordAllMethod cop in 2.21.0 #1109

gotchin opened this issue Sep 11, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@gotchin
Copy link

gotchin commented Sep 11, 2023

Updating rubocop-rails from 2.20.2 to 2.21.0 leads to some errors.

Expected behavior

It shouldn't throw any errors

Actual behavior

Rubocop fails with errors like An error occurred while Rails/RedundantActiveRecordAllMethod cop was inspecting <file>

Stacktrace

An error occurred while Rails/RedundantActiveRecordAllMethod cop was inspecting /Users/gotchin/work/test.rb:5:12.
Expected a Parser::Source::Range, Comment or RuboCop::AST::Node, got NilClass
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/corrector.rb:111:in to_range' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/corrector.rb:120:in check_range_validity'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:398:in combine' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:194:in replace'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:218:in remove' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-rails-2.21.0/lib/rubocop/cop/rails/redundant_active_record_all_method.rb:146:in block in on_send'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/base.rb:377:in correct' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/base.rb:181:in add_offense'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-rails-2.21.0/lib/rubocop/cop/rails/redundant_active_record_all_method.rb:144:in on_send' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:143:in public_send'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:143:in block (2 levels) in trigger_restricted_cops' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:171:in with_cop_error_handling'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:142:in block in trigger_restricted_cops' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:141:in each'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:141:in trigger_restricted_cops' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:70:in on_send'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:159:in block in on_send' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:156:in each'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:156:in each_with_index' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:156:in on_send'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:71:in on_send' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:154:in on_def'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:71:in on_def' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:137:in block in on_dstr'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:137:in each' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:137:in on_dstr'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:71:in on_begin' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:154:in on_class'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:71:in on_class' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:20:in walk'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:87:in investigate' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/team.rb:156:in investigate_partial'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/team.rb:98:in investigate' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:345:in block in inspect_file'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:344:in each' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:344:in flat_map'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:344:in inspect_file' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:287:in block in do_inspection_loop'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:321:in block in iterate_until_no_changes' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:314:in loop'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:314:in iterate_until_no_changes' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:283:in do_inspection_loop'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:164:in block in file_offenses' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:189:in file_offense_cache'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:163:in file_offenses' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:154:in process_file'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:135:in block in each_inspected_file' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:134:in each'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:134:in reduce' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:134:in each_inspected_file'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:120:in inspect_files' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:73:in run'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command/execute_runner.rb:26:in block in execute_runner' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command/execute_runner.rb:52:in with_redirect'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command/execute_runner.rb:25:in execute_runner' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command/execute_runner.rb:17:in run'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command.rb:11:in run' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/environment.rb:18:in run'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:118:in run_command' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:125:in execute_runners'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:51:in block in run' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:77:in profile_if_needed'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:43:in run' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/exe/rubocop:19:in block in <top (required)>'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/3.2.0/benchmark.rb:311:in realtime' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/exe/rubocop:19:in <top (required)>'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/bin/rubocop:25:in load' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/bin/rubocop:25:in <top (required)>'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in load' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in kernel_load'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:23:in run' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:492:in exec'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:34:in dispatch'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:28:in start'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/exe/bundle:37:in block in <top (required)>' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/friendly_errors.rb:117:in with_friendly_errors'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/exe/bundle:29:in <top (required)>' bin/bundle:3:in load'
bin/bundle:3:in <main>' An error occurred while Rails/RedundantActiveRecordAllMethod cop was inspecting /Users/gotchin/work/test.rb:5:24. Expected a Parser::Source::Range, Comment or RuboCop::AST::Node, got NilClass /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/corrector.rb:111:in to_range'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/corrector.rb:120:in check_range_validity' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:398:in combine'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:194:in replace' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:218:in remove'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-rails-2.21.0/lib/rubocop/cop/rails/redundant_active_record_all_method.rb:146:in block in on_send' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/base.rb:377:in correct'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/base.rb:181:in add_offense' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-rails-2.21.0/lib/rubocop/cop/rails/redundant_active_record_all_method.rb:144:in on_send'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:143:in public_send' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:143:in block (2 levels) in trigger_restricted_cops'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:171:in with_cop_error_handling' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:142:in block in trigger_restricted_cops'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:141:in each' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:141:in trigger_restricted_cops'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:70:in on_send' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:159:in block in on_send'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:156:in each' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:156:in each_with_index'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:156:in on_send' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:71:in on_send'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:154:in on_def' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:71:in on_def'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:137:in block in on_dstr' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:137:in each'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:137:in on_dstr' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:71:in on_begin'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:154:in on_class' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:71:in on_class'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/traversal.rb:20:in walk' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/commissioner.rb:87:in investigate'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/team.rb:156:in investigate_partial' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cop/team.rb:98:in investigate'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:345:in block in inspect_file' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:344:in each'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:344:in flat_map' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:344:in inspect_file'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:287:in block in do_inspection_loop' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:321:in block in iterate_until_no_changes'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:314:in loop' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:314:in iterate_until_no_changes'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:283:in do_inspection_loop' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:164:in block in file_offenses'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:189:in file_offense_cache' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:163:in file_offenses'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:154:in process_file' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:135:in block in each_inspected_file'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:134:in each' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:134:in reduce'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:134:in each_inspected_file' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:120:in inspect_files'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/runner.rb:73:in run' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command/execute_runner.rb:26:in block in execute_runner'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command/execute_runner.rb:52:in with_redirect' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command/execute_runner.rb:25:in execute_runner'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command/execute_runner.rb:17:in run' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/command.rb:11:in run'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli/environment.rb:18:in run' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:118:in run_command'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:125:in execute_runners' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:51:in block in run'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:77:in profile_if_needed' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/lib/rubocop/cli.rb:43:in run'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/exe/rubocop:19:in block in <top (required)>' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/3.2.0/benchmark.rb:311:in realtime'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/gems/rubocop-1.56.2/exe/rubocop:19:in <top (required)>' /Users/gotchin/work/vendor/bundle/ruby/3.2.0/bin/rubocop:25:in load'
/Users/gotchin/work/vendor/bundle/ruby/3.2.0/bin/rubocop:25:in <top (required)>' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in load'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in kernel_load' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:23:in run'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:492:in exec' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:34:in dispatch' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:28:in start' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/exe/bundle:37:in block in <top (required)>'
/Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/lib/bundler/friendly_errors.rb:117:in with_friendly_errors' /Users/gotchin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/exe/bundle:29:in <top (required)>'

Steps to reproduce the problem

class Test
  def call(klass1, klass2)
    average(klass1.all, klass2.all)
  end

  private

  def average(relation1, relation2)
    relation1.count / relation2.count
  end
end

RuboCop version

bundle exec rubocop -V
1.56.2 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.2.2) [arm64-darwin22]
  - rubocop-factory_bot 2.23.1
  - rubocop-graphql 1.4.0
  - rubocop-inflector 0.2.1
  - rubocop-rails 2.21.0
  - rubocop-rspec 2.23.2
@koic koic added the bug Something isn't working label Sep 11, 2023
masato-bkn added a commit to masato-bkn/rubocop-rails that referenced this issue Sep 11, 2023
…od` when `all` is an argument for AR methods
@koic koic closed this as completed in fc9bf0c Sep 11, 2023
koic added a commit that referenced this issue Sep 11, 2023
…ecord_all_method_when_all_is_argument

[Fix: #1109] Fix error for `Rails/RedundantActiveRecordAllMethod` when `all` is an argument for AR methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants