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

Enable or disable groups of cops? #2343

Closed
marnen opened this issue Oct 23, 2015 · 9 comments
Closed

Enable or disable groups of cops? #2343

marnen opened this issue Oct 23, 2015 · 9 comments

Comments

@marnen
Copy link

marnen commented Oct 23, 2015

Is it possible to set configuration options by group? I'd love to be able to do

Style:
  Enabled: false
Metrics:
  Enabled: true

Maybe even overrides:

Style:
  Enabled: false
Metrics:
  Enabled: true
Metrics/UselessMetric:
  Enabled: false

...though that may be less necessary.

Basically, what I'm looking for is a generalized version of RunRailsCops. Does this exist?

@jonas054
Copy link
Collaborator

No, but you can run rubocop --only Style, etc.

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 23, 2015

Probably it makes sense for us to make it possible to do this via the config. I recall I was thinking about this a while back myself.

@marnen
Copy link
Author

marnen commented Oct 23, 2015

@jonas054: I know about --only, but that won't work for me—I'm trying to configure the Rubocop engine on CodeClimate, and the only way to do that is with the YAML config file.

@bbatsov: It seems to me that any command line option of this sort should have an equivalent config file setting.

@jonas054
Copy link
Collaborator

I wonder if it's better to introduce a configuration option AllCops: CommandLineOptions, an array that would be prepended to the real command line options. It would solve a lot of current and future problems in one fell swoop, but there might also be some issues with mixing CLI and configuration like this. And it would be a detour from the road we've embarked upon before, when we added individual config options like RunRailsCops, DisplayCopNames, etc.

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 24, 2015

We already discussed this a while back, so I think it's too late for this.
But any solution would rid us of the Rails specific config, which would be
a good thing.

On Saturday, 24 October 2015, Jonas Arvidsson [email protected]
wrote:

I wonder if it's better to introduce a configuration option AllCops:
CommandLineOptions, an array that would be prepended to the real command
line options. It would solve a lot of current and future problems in one
fell swoop, but there might also be some issues with mixing CLI and
configuration like this. And it would be a detour from the road we've
embarked upon before, when we added individual config options like
RunRailsCops, DisplayCopNames, etc.


Reply to this email directly or view it on GitHub
#2343 (comment).

Best Regards,
Bozhidar Batsov

http://www.batsov.com

@alexdowad
Copy link
Contributor

I wonder if it's better to introduce a configuration option AllCops: CommandLineOptions

This would be very powerful, but opens a can of worms when multiple config files are used in different subdirectories. Any idea how to get around that?

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 26, 2015

As I already said - I think this would be a mistake. Let's limit the scope of the task to simply what was request here and drop the RunRailsCops option when there's a generic solution to refer to a group of cops.

@alexdowad
Copy link
Contributor

Just pushed a fix for this one to my open PR.

@alexdowad
Copy link
Contributor

Also added a commit which drops RunRailsCops.

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

4 participants