You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Grep/Grep cop occurs an error when running.
I have prepared .rubocop.yml as follows from the README:
require:
- rubocop-grepGrep/Grep:
Rules:
# The simplest rule definition. It warns if the regexp matches your code.
- Pattern: '\bENV\b'Message: Do not refer ENV directly.
The following error occurs:
An error occurred while Grep/Grepx cop was inspecting /Users/ydah/sandbox-rubocop-grep/target.rb.
undefined method `each' for nil:NilClass
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-grep-0.1.0/lib/rubocop/cop/grep/grep.rb:13:in `on_new_investigation'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cop/commissioner.rb:160:in `block (2 levels) in invoke'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cop/commissioner.rb:171:in `with_cop_error_handling'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cop/commissioner.rb:160:in `block in invoke'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cop/commissioner.rb:160:in `each'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cop/commissioner.rb:160:in `invoke'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cop/commissioner.rb:84:in `investigate'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cop/team.rb:156:in `investigate_partial'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cop/team.rb:98:in `investigate'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:345:in `block in inspect_file'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:344:in `each'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:344:in `flat_map'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:344:in `inspect_file'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:287:in `block in do_inspection_loop'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:321:in `block in iterate_until_no_changes'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:314:in `loop'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:314:in `iterate_until_no_changes'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:283:in `do_inspection_loop'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:164:in `block in file_offenses'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:189:in `file_offense_cache'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:163:in `file_offenses'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:154:in `process_file'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:135:in `block in each_inspected_file'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:134:in `each'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:134:in `reduce'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:134:in `each_inspected_file'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:120:in `inspect_files'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/runner.rb:73:in `run'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli/command.rb:11:in `run'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli/environment.rb:18:in `run'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli.rb:118:in `run_command'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli.rb:125:in `execute_runners'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli.rb:51:in `block in run'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli.rb:77:in `profile_if_needed'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/lib/rubocop/cli.rb:43:in `run'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/exe/rubocop:19:in `block in <top (required)>'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rubocop-1.48.1/exe/rubocop:19:in `<top (required)>'
/Users/ydah/.rbenv/versions/3.2.0/bin/rubocop:25:in `load'
/Users/ydah/.rbenv/versions/3.2.0/bin/rubocop:25:in `<top (required)>'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:491:in `exec'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/libexec/bundle:45:in `block in <top (required)>'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/Users/ydah/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/libexec/bundle:33:in `<top (required)>'
/Users/ydah/.rbenv/versions/3.2.0/bin/bundle:25:in `load'
/Users/ydah/.rbenv/versions/3.2.0/bin/bundle:25:in `<main>'
.
1 file inspected, no offenses detected
1 error occurred:
An error occurred while Grep/Grepx cop was inspecting /Users/ydah/sandbox-rubocop-grep/target.rb.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop/rubocop/issues
Maybe, It appears that efca293, which hacked for steep, is the cause.
It appears that an error is occurring because the each method is being called for nil because it references cop_config in Grep/Grepx at runtime.
I thought updating steep gem would solve this problem.
Submitted another pull request #8 🙏
(As far as I tested, it seems like this will probably be fixed in steep 1.4.0.dev.5 or later.)
Hello.
Grep/Grep
cop occurs an error when running.I have prepared
.rubocop.yml
as follows from the README:The following error occurs:
Maybe, It appears that efca293, which hacked for steep, is the cause.
It appears that an error is occurring because the
each
method is being called for nil because it referencescop_config
inGrep/Grepx
at runtime.rubocop-grep/lib/rubocop/cop/grep/grep.rb
Line 13 in aed0a27
This will work with the following fixes, but the cop name in the offense log is still wrong (Grep/Grepx).
The following offense logs occur:
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: