We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Lint/Void errors a lot if CheckForMethodsWithNoSideEffects configuration is set to true.
Lint/Void
CheckForMethodsWithNoSideEffects
RuboCop does not error.
$ rubocop -d --only Lint/Void main1.rb For ...: configuration from .../.rubocop.yml Default configuration from .../rubocop-1.44.0/config/default.yml Use parallel by default. Skipping parallel inspection: only a single file needs inspection Inspecting 1 file Scanning .../main1.rb An error occurred while Lint/Void cop was inspecting .../main1.rb:3:0. undefined method `method_name' for s(:lvasgn, :foo, s(:send, nil, :bar)):RuboCop::AST::AsgnNode method_name = node.method_name ^^^^^^^^^^^^ Did you mean? method .../rubocop-1.44.0/lib/rubocop/cop/lint/void.rb:131:in `check_nonmutating' .../rubocop-1.44.0/lib/rubocop/cop/lint/void.rb:97:in `check_expression' .../rubocop-1.44.0/lib/rubocop/cop/lint/void.rb:86:in `block in check_begin' .../rubocop-1.44.0/lib/rubocop/cop/lint/void.rb:86:in `each' .../rubocop-1.44.0/lib/rubocop/cop/lint/void.rb:86:in `check_begin' .../rubocop-1.44.0/lib/rubocop/cop/lint/void.rb:77:in `on_begin' .../rubocop-1.44.0/lib/rubocop/cop/commissioner.rb:101:in `public_send' .../rubocop-1.44.0/lib/rubocop/cop/commissioner.rb:101:in `block (2 levels) in trigger_responding_cops' .../rubocop-1.44.0/lib/rubocop/cop/commissioner.rb:165:in `with_cop_error_handling' .../rubocop-1.44.0/lib/rubocop/cop/commissioner.rb:100:in `block in trigger_responding_cops' .../rubocop-1.44.0/lib/rubocop/cop/commissioner.rb:99:in `each' .../rubocop-1.44.0/lib/rubocop/cop/commissioner.rb:99:in `trigger_responding_cops' .../rubocop-1.44.0/lib/rubocop/cop/commissioner.rb:69:in `on_begin' .../rubocop-ast-1.24.1/lib/rubocop/ast/traversal.rb:20:in `walk' .../rubocop-1.44.0/lib/rubocop/cop/commissioner.rb:87:in `investigate' .../rubocop-1.44.0/lib/rubocop/cop/team.rb:154:in `investigate_partial' .../rubocop-1.44.0/lib/rubocop/cop/team.rb:97:in `investigate' .../rubocop-1.44.0/lib/rubocop/runner.rb:322:in `inspect_file' .../rubocop-1.44.0/lib/rubocop/runner.rb:266:in `block in do_inspection_loop' .../rubocop-1.44.0/lib/rubocop/runner.rb:300:in `block in iterate_until_no_changes' .../rubocop-1.44.0/lib/rubocop/runner.rb:293:in `loop' .../rubocop-1.44.0/lib/rubocop/runner.rb:293:in `iterate_until_no_changes' .../rubocop-1.44.0/lib/rubocop/runner.rb:262:in `do_inspection_loop' .../rubocop-1.44.0/lib/rubocop/runner.rb:143:in `block in file_offenses' .../rubocop-1.44.0/lib/rubocop/runner.rb:168:in `file_offense_cache' .../rubocop-1.44.0/lib/rubocop/runner.rb:142:in `file_offenses' .../rubocop-1.44.0/lib/rubocop/runner.rb:133:in `process_file' .../rubocop-1.44.0/lib/rubocop/runner.rb:114:in `block in each_inspected_file' .../rubocop-1.44.0/lib/rubocop/runner.rb:113:in `each' .../rubocop-1.44.0/lib/rubocop/runner.rb:113:in `reduce' .../rubocop-1.44.0/lib/rubocop/runner.rb:113:in `each_inspected_file' .../rubocop-1.44.0/lib/rubocop/runner.rb:99:in `inspect_files' .../rubocop-1.44.0/lib/rubocop/runner.rb:52:in `run' .../rubocop-1.44.0/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner' .../rubocop-1.44.0/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect' .../rubocop-1.44.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner' .../rubocop-1.44.0/lib/rubocop/cli/command/execute_runner.rb:17:in `run' .../rubocop-1.44.0/lib/rubocop/cli/command.rb:11:in `run' .../rubocop-1.44.0/lib/rubocop/cli/environment.rb:18:in `run' .../rubocop-1.44.0/lib/rubocop/cli.rb:72:in `run_command' .../rubocop-1.44.0/lib/rubocop/cli.rb:79:in `execute_runners' .../rubocop-1.44.0/lib/rubocop/cli.rb:48:in `run' .../rubocop-1.44.0/exe/rubocop:19:in `block in <top (required)>' .../lib/ruby/3.1.0/benchmark.rb:311:in `realtime' .../rubocop-1.44.0/exe/rubocop:19:in `<top (required)>' .../bin/rubocop:25:in `load' .../bin/rubocop:25:in `<main>' . 1 file inspected, no offenses detected 1 error occurred: An error occurred while Lint/Void cop was inspecting .../main1.rb:3:0. Errors are usually caused by RuboCop bugs. Please, report your problems to RuboCop's issue tracker. https://github.com/rubocop/rubocop/issues Mention the following information in the issue report: 1.44.0 (using Parser 3.2.0.0, rubocop-ast 1.24.1, running on ruby 3.1.1) [x86_64-darwin20] Finished in 0.17194200000085402 seconds $
.rubocop.yml
AllCops: NewCops: enable Lint/Void: CheckForMethodsWithNoSideEffects: true
main1.rb
# frozen_string_literal: true foo = bar baz
main2.rb
# frozen_string_literal: true module Foo end module Bar end
main3.rb
# frozen_string_literal: true if foo end bar
$ rubocop -V 1.44.0 (using Parser 3.2.0.0, rubocop-ast 1.24.1, running on ruby 3.1.1) [x86_64-darwin20] $
The text was updated successfully, but these errors were encountered:
[Fix rubocop#11492] Fix an error for Lint/Void
48f3d1f
Fixes rubocop#11492. This PR fixes an error for `Lint/Void` when configuring `CheckForMethodsWithNoSideEffects: true`.
Merge pull request #11493 from koic/fix_an_error_for_lint_void
aa08c25
[Fix #11492] Fix an error for `Lint/Void`
Successfully merging a pull request may close this issue.
Lint/Void
errors a lot ifCheckForMethodsWithNoSideEffects
configuration is set to true.Expected behavior
RuboCop does not error.
Actual behavior
Steps to reproduce the problem
.rubocop.yml
main1.rb
main2.rb
main3.rb
RuboCop version
The text was updated successfully, but these errors were encountered: