-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add --show-linter-names
option
#340
Conversation
58019ac
to
804c838
Compare
8062d65
to
ec580e6
Compare
As soon as I opened this, I spotted that @Earlopain already has a similar PR: #328 The main differences are:
|
Your implementation is better, I've closed my PR. I do think it should be enabled by default though, same as RuboCop does it. They print cop names if there is more than one cop enabled, so if you run with |
Thanks @Earlopain My only concern about enabling it by default is that someone may have built tooling based on the current report format (although the JSON reporter would have been a better choice). I'll wait for others to weigh in on whether to make this the default behaviour. |
Note: If allowing this to be set, we should probably also add a |
@@ -74,7 +74,7 @@ def run(args = ARGV) | |||
@stats.linters = enabled_linter_classes.size | |||
@stats.autocorrectable_linters = enabled_linter_classes.count(&:support_autocorrect?) | |||
|
|||
reporter = Reporter.create_reporter(@options[:format], @stats, autocorrect?) | |||
reporter = Reporter.create_reporter(@options[:format], @stats, autocorrect?, @options[:show_linter_names]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(if we need to add more options in future, it might be better to change this to pass the options
hash, rather than individual options).
ec580e6
to
ba09d0b
Compare
Rebased to resolve conflicts. |
Closes #336
This PR adds a
--show-linter-names
option. It prepends each offence with the linter name.It applies only to the Multiline and Compact reporters. The JSON and JUnit reporters already include the linter name, so I have left them as-is.
Note: If RuboCop is enabled, RuboCop offences will display as:
(the cop name part was already there, but having the
[RuboCop]
prefix now makes it easier to distinguish the source of each offence).