solargraph
solargraph copied to clipboard
Rubocop extra_args not being picked up
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?
It sounds like your concern is with problem descriptions in the diagnostics display. The RuboCop diagnostics reporter should display the cop name by default:
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
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
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'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").