When an offense is detected, print the cop name as well. It would also be good to have good documentation around each cop/offense. (See foodcritic as a good example around documentation around linting.)
+1, grepping rubocop's source for the offender is annoying.
Guys, you should really start reading the help/readme :-)
rubocop -d ...
Where exactly in the huge README does it say -d will print the offending cop names?
It says you'll get "extra debug output" (which admittedly is a big vague, but I'd definitely expect the cop name in a debug output).
What about cop documentation?—
Sent from Mailbox for iPhone
On Mon, Dec 30, 2013 at 5:50 PM, Bozhidar Batsov [email protected]
wrote:
It says you'll get "extra debug output" (which admittedly is a big vague, but I'd definitely expect the cop name in a debug output).
Reply to this email directly or view it on GitHub:
https://github.com/bbatsov/rubocop/issues/705#issuecomment-31374109
@CBarraford Most of the rules are derived from the Ruby Style Guide, but since many of the cops are configurable we cannot just link to the guide as foodcritic does. I has been suggested to make it possible to generate a custom version of the guide from RuboCop's config (https://github.com/bbatsov/rubocop/issues/379), but that will be a lot of work and it's pretty low on my to-do list.
I'm not arguing that we don't need better docs - we certainly do. I'm just saying I don't have the time to produce them. Help is welcome :-)
+1 the cop name should always be present, -d is way too verbose for what's asked in this issue
@tamird Displaying the cop names always doesn't make sense for several reasons, but we could have either a dedicated flag for that or maybe a project-level option. Personally I'm in favour of an extra flag. @jonas054 @yujinakayama What do you think?
Extra flag sounds OK, but I'm curious to know what the use case is exactly. @CBarraford @phs @tamird Why do you need the cop name, and what the problem with the extra verbosity of -d?
Need the cop name to disable/tweak the cop's settings (rather than fixing the offence). In a large shared codebase, this happens a lot.
The extra verbosity is also problematic when it causes 2k lines of extra output. Again, large shared codebase.
In my case, I want the cop name so I can edit my rubocop.xml without needing to search through source code to figure it out. Part 2 is figuring out what the config options are per cop, which is not documented. —
Sent from Mailbox for iPhone
On Thu, Jan 2, 2014 at 7:49 PM, Jonas Arvidsson [email protected]
wrote:
Extra flag sounds OK, but I'm curious to know what the use case is exactly. @CBarraford @phs @tamird Why do you need the cop name, and what the problem with the extra verbosity of
-d?Reply to this email directly or view it on GitHub:
https://github.com/bbatsov/rubocop/issues/705#issuecomment-31498168
I use the cop name to configure cops or disable them with line comments when the suggested correction won't do.
Thanks for the clarifications!
@CBarraford Your use case sounds like a perfect fit for the --auto-gen-config option. Have you tried it? And also, the configuraton options _are_ documented. If you follow the link in the paragraph "Most aspects of its behavior can be tweaked via various configuration options." near the top of the README, you'll find config/default.yml where you can see which parameters exist and what they mean.
@tamird Would --auto-gen-config work for you?
@phs In your case, I'd say that a new flag for printing the cop names with the offence reports would be an improvement.
OK, I'll add a switch about this.
Though it's not a perfect solution for this, haven't we forgotten --format offences? :)
@jonas054 --auto-gen-config isn't quite right. sometimes i want to rubocop just one file, and already have a config in place. That means that in order to run --auto-gen-config I need to move it, run it, and inspect the differences. Kludgy. --format offences is no good because it doesn't show you any of the regular information.
@bbatsov I think a switch for this is the right way to go.
Most helpful comment
Need the cop name to disable/tweak the cop's settings (rather than fixing the offence). In a large shared codebase, this happens a lot.