-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Regression in FormatParameterMismatch? #3869
Comments
I can try to whittle down the code causing the error later |
Minimal reproduction $ echo "'%' % []" | bin/rubocop --only FormatParameterMismatch --stdin - --debug
For /Users/johnbackus/Projects/rubocop: configuration from /Users/johnbackus/Projects/rubocop/.rubocop.yml
Inheriting configuration from /Users/johnbackus/Projects/rubocop/.rubocop_todo.yml
Default configuration from /Users/johnbackus/Projects/rubocop/config/default.yml
Inheriting configuration from /Users/johnbackus/Projects/rubocop/config/enabled.yml
Inheriting configuration from /Users/johnbackus/Projects/rubocop/config/disabled.yml
Inspecting 1 file
Scanning /Users/johnbackus/Projects/rubocop/-
An error occurred while Lint/FormatParameterMismatch cop was inspecting /Users/johnbackus/Projects/rubocop/-.
undefined method `type' for nil:NilClass
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/lint/format_parameter_mismatch.rb:139:in `arguments_count'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/lint/format_parameter_mismatch.rb:107:in `count_matches'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/lint/format_parameter_mismatch.rb:46:in `offending_node?'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/lint/format_parameter_mismatch.rb:36:in `on_send'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/commissioner.rb:41:in `block (2 levels) in on_send'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/commissioner.rb:100:in `with_cop_error_handling'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/commissioner.rb:40:in `block in on_send'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/commissioner.rb:39:in `each'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/commissioner.rb:39:in `on_send'
/Users/johnbackus/Projects/rubocop/lib/rubocop/ast/traversal.rb:12:in `walk'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/commissioner.rb:58:in `investigate'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/team.rb:121:in `investigate'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/team.rb:109:in `offenses'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cop/team.rb:51:in `inspect_file'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:248:in `inspect_file'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:195:in `block in do_inspection_loop'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:227:in `block in iterate_until_no_changes'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:220:in `loop'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:220:in `iterate_until_no_changes'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:191:in `do_inspection_loop'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:101:in `block in file_offenses'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:111:in `file_offense_cache'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:99:in `file_offenses'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:90:in `process_file'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:68:in `block in each_inspected_file'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:65:in `each'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:65:in `reduce'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:65:in `each_inspected_file'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:57:in `inspect_files'
/Users/johnbackus/Projects/rubocop/lib/rubocop/runner.rb:36:in `run'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cli.rb:72:in `execute_runner'
/Users/johnbackus/Projects/rubocop/lib/rubocop/cli.rb:27:in `run'
bin/rubocop:13:in `block in <main>'
/Users/johnbackus/.rubies/ruby-2.3.1/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
bin/rubocop:12:in `<main>'
.
1 file inspected, no offenses detected
1 error occurred:
An error occurred while Lint/FormatParameterMismatch cop was inspecting /Users/johnbackus/Projects/rubocop/-.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
Mention the following information in the issue report:
0.46.0 (using Parser 2.3.3.1, running on ruby 2.3.1 x86_64-darwin16)
Finished in 0.06896200001938269 seconds |
^^ @zverok |
Drenmi
added a commit
to Drenmi/rubocop
that referenced
this issue
Jan 7, 2017
…ng when `#%` is passed an empty array This cop would break if `#%` was passed an empty array, as it attempted to check the type of the last element of the array (which would be `nil`.) This change fixes that.
Sorry :( And thanks @Drenmi for the fix. |
No worries. Ruby has so many edge cases, it would be strange if we didn't have these now and then. 😊 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After looking at @pocke's findings for #3868 I ran the latest rubocop build on rubyspec. This file seems to have found an error with
FormatParameterMismatch
: https://github.com/ruby/spec/blob/cee95712953b1b913b7a4933ac07816a39a7acd8/core/string/modulo_spec.rbThe text was updated successfully, but these errors were encountered: