Skip to content

Rubocop doesn't show the cop name in guard-rubocop but it does on the CLI #42

@coaxial

Description

@coaxial

Compare:

$ bundle exec rubocop
Inspecting 14 files
............W.

Offenses:

spec/my_spec.rb:42:1: W: Lint/MissingCopEnableDirective: Re-enable Lint/HandleExceptions cop with # rubocop:enable after disabling it.
        # rescue SystemExit # rubocop:disable Lint/HandleExceptions
^
spec/my_spec.rb:43:26: C: Layout/TrailingWhitespace: Trailing whitespace detected.
        rescue SystemExit
                         ^

14 files inspected, 2 offenses detected

with

$ bundle exec guard
08:02:31 - INFO - Guard::RSpec is running
08:02:31 - INFO - Inspecting Ruby code style of all files
Inspecting 14 files
............W.

Offenses:

spec/my_spec.rb:42:1: W: Re-enable Lint/HandleExceptions cop with # rubocop:enable after disabling it.
        # rescue SystemExit # rubocop:disable Lint/HandleExceptions
^
spec/my_spec.rb:43:26: C: Trailing whitespace detected.
        rescue SystemExit
                         ^

When running guard-rubocop, the name of the cop that matches the lint error isn't written. But it is when running rubocop directly. I have no options set on my guard:

guard :rubocop do
  watch('Gemfile')
  watch('Rakefile')
  watch(/.+\.rb$/)
  watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions