-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Style/DisableCopsWithinSourceCodeDirectory errors out #9431
Labels
Comments
koic
added a commit
to koic/rubocop
that referenced
this issue
Jan 28, 2021
…eDirective` Fixes rubocop#9431. Fix the following error for `Style/DisableCopsWithinSourceCodeDirective` when using leading source comment. ```console % cat example.rb # frozen_string_literal: true class Foo end % bundle exec rubocop example.rb --only Style/DisableCopsWithinSourceCodeDirective -d (snip) Inspecting 1 file Scanning /Users/koic/src/github.com/koic/rubocop-issues/master/example.rb An error occurred while Style/DisableCopsWithinSourceCodeDirective cop was inspecting /Users/koic/src/github.com/koic/rubocop-issues/master/example.rb. undefined method `[]' for nil:NilClass /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/style/ disable_cops_within_source_code_directive.rb:74:in `directive_cops' /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/style/ disable_cops_within_source_code_directive.rb:42:in `block in on_new_investigation' /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/style/ disable_cops_within_source_code_directive.rb:41:in `each' /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/style/ disable_cops_within_source_code_directive.rb:41:in `on_new_investigation' ```
8 tasks
bbatsov
pushed a commit
that referenced
this issue
Jan 28, 2021
…ive` Fixes #9431. Fix the following error for `Style/DisableCopsWithinSourceCodeDirective` when using leading source comment. ```console % cat example.rb # frozen_string_literal: true class Foo end % bundle exec rubocop example.rb --only Style/DisableCopsWithinSourceCodeDirective -d (snip) Inspecting 1 file Scanning /Users/koic/src/github.com/koic/rubocop-issues/master/example.rb An error occurred while Style/DisableCopsWithinSourceCodeDirective cop was inspecting /Users/koic/src/github.com/koic/rubocop-issues/master/example.rb. undefined method `[]' for nil:NilClass /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/style/ disable_cops_within_source_code_directive.rb:74:in `directive_cops' /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/style/ disable_cops_within_source_code_directive.rb:42:in `block in on_new_investigation' /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/style/ disable_cops_within_source_code_directive.rb:41:in `each' /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/style/ disable_cops_within_source_code_directive.rb:41:in `on_new_investigation' ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior
I expect the Cop to not throw an error
Actual behavior
Right now the specified Cop throws an error when running the RuboCop linter.
Steps to reproduce the problem
This happens in 8 different files.
This is my
spec_helper.rb
for example:RuboCop version
The text was updated successfully, but these errors were encountered: