Skip to content
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

Rubocop extra_args not being picked up #486

Open
dgmora opened this issue Sep 30, 2021 · 4 comments
Open

Rubocop extra_args not being picked up #486

dgmora opened this issue Sep 30, 2021 · 4 comments

Comments

@dgmora
Copy link
Contributor

dgmora commented Sep 30, 2021

I may be doing something wrong, but I've tried with the following config:

---
include:
- "**/*.rb"
exclude:
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
require:
  - actioncable
  - actionmailer
  - actionpack
  - actionview
  - activejob
  - activemodel
  - activerecord
  - activestorage
  - activesupport
domains: []
reporters:
- rubocop
formatter:
  rubocop:
    cops: all
    except:
      - 'RSpec/Focus'
    only: []
    extra_args:
      - '-D'
      - '--config'
      - '.rubocop.local.yml'
require_paths: []
plugins: []
max_files: 5000

extra_args does not seem to pick up -D (to show the cop name), it only shows the error message. --config also does not seem to work, it's picking up rubocop.yml instead of rubocop.local.yml. Are the extra args specified incorrectly?

@castwide
Copy link
Owner

castwide commented Oct 1, 2021

It sounds like your concern is with problem descriptions in the diagnostics display. The RuboCop diagnostics reporter should display the cop name by default:

image

The options under formatter only apply to formatting, not diagnostics. That was a deliberate choice due to cases where the formatter needs additional arguments that the reporter doesn't (see #403). I might be able to add support for reporter options in the future, if that's what you need. In the meantime, one possible workaround is to create a .rubocop.yml file that includes .rubocop.local.yml, e.g.:

inherit_from: ./.rubocop.local.yml

@dgmora
Copy link
Contributor Author

dgmora commented Oct 1, 2021

The cops don't appear in the diagnostics, but that might have to do with my vim configuration.
The formatter still doesn't seem to accept the --config flag, it formats based on rubocop.yml

@hjw
Copy link

hjw commented Nov 1, 2021

I'm not seeing the cop name in my diagnostics either and I am not sure where to look to figure this out.
Can we get a hint?

@castwide
Copy link
Owner

I'm not seeing the cop name in my diagnostics either and I am not sure where to look to figure this out. Can we get a hint?

I assume the editor doesn't display the source and/or code parameters of the Diagnostics in the textDocument/publishDiagnostics notification. If there's a way you can log the server messages, you should be able to see them there. For the RuboCop reporter. the source is always "rubocop" and the code is the name of the cop (e.g., "Layout/EndOfLine").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants