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

Make it possible to enable/disable pending cops via a configuration option #7850

Closed
bbatsov opened this issue Apr 5, 2020 · 6 comments
Closed
Assignees
Milestone

Comments

@bbatsov
Copy link
Collaborator

@bbatsov bbatsov commented Apr 5, 2020

Is your feature request related to a problem? Please describe.

It seems some people are frustrated by the fact they have to manually enable/disable pending cops (see #7771). This also came up a few times in the RuboCop defaults survey.

Describe the solution you'd like

We should add configuration option allowing pending cops to be treated as pending (default), enabled or disabled by default. This would allow everyone to decide how to best handle those those.

Describe alternatives you've considered

I don't think there are any better alternatives.

@rubocop-hq/rubocop-core Any thoughts on this?

@bbatsov bbatsov added this to the 1.0.0 milestone Apr 5, 2020
@koic
Copy link
Member

@koic koic commented Apr 5, 2020

I think that the new feature will lead to a solution. I'm considering command line and configuration options.

Command line options

Run including pending cops.

% rubocop --with-pending-cops

Run excluding pending cops.

% rubocop --without-pending-cops

.rubocop.yml configuration

In addition, it is an example to specify in .rubocop.yml instead of the command line option. These configuration values have the same meaning as the Enabled option's values.

AllCops:
  EnabledNewCops: pending # default
AllCops:
  EnabledNewCops: true
AllCops:
  EnabledNewCops: false

Maybe option and configuration names could be considered further.

@bbatsov
Copy link
Collaborator Author

@bbatsov bbatsov commented Apr 5, 2020

% rubocop --with-pending-cops

I'm fine with the proposal but let's use naming like --enable/disable-pending-cops instead. I think that's easier to understand.

AllCops:
  EnabledNewCops: pending # default

Yeah, that's more or less what I had in mind. I guess the option can be named "NewCops" and have potential values "enable", "disable", "pending". Generally, we can go only with the command-line option, as users can put it in their .rubocop if they want to use it all the time.

@koic
Copy link
Member

@koic koic commented Apr 6, 2020

These naming sounds easy to understand 🌟I will take this issue!

@koic koic self-assigned this Apr 6, 2020
koic added a commit to koic/rubocop that referenced this issue Apr 7, 2020
Resolves rubocop-hq#7850.

This PR will add `--enable-pending-cops` and `--disable-pending-cops`
command-line options and `NewCops` will be provided in .rubocop.yml.

When `NewCops` is `enable`, pending cops are enabled in bulk.

```yaml
AllCops:
  NewCops: enable
```

Can be overridden by the `--enable-pending-cops` command-line option.

When `NewCops` is `disable`, pending cops are disabled in bulk.

```yaml
AllCops:
  NewCops: disable
```

Can be overridden by the `--disable-pending-cops` command-line option.

The default value of `NewCops` is `pending`.
koic added a commit to koic/rubocop that referenced this issue Apr 7, 2020
Resolves rubocop-hq#7850.

This PR will add `--enable-pending-cops` and `--disable-pending-cops`
command-line options and `NewCops` will be provided in .rubocop.yml.

When `NewCops` is `enable`, pending cops are enabled in bulk.

```yaml
AllCops:
  NewCops: enable
```

Can be overridden by the `--enable-pending-cops` command-line option.

When `NewCops` is `disable`, pending cops are disabled in bulk.

```yaml
AllCops:
  NewCops: disable
```

Can be overridden by the `--disable-pending-cops` command-line option.

The default value of `NewCops` is `pending`.
@bbatsov bbatsov closed this in #7856 Apr 7, 2020
bbatsov added a commit that referenced this issue Apr 7, 2020
Resolves #7850.

This PR will add `--enable-pending-cops` and `--disable-pending-cops`
command-line options and `NewCops` will be provided in .rubocop.yml.

When `NewCops` is `enable`, pending cops are enabled in bulk.

```yaml
AllCops:
  NewCops: enable
```

Can be overridden by the `--enable-pending-cops` command-line option.

When `NewCops` is `disable`, pending cops are disabled in bulk.

```yaml
AllCops:
  NewCops: disable
```

Can be overridden by the `--disable-pending-cops` command-line option.

The default value of `NewCops` is `pending`.
@ShockwaveNN
Copy link
Contributor

@ShockwaveNN ShockwaveNN commented Apr 17, 2020

I think it's worth mention that final variant in rubocop 0.82.0
not

AllCops:
  EnabledNewCops: true

But

AllCops:
  NewCops: enable
@koic
Copy link
Member

@koic koic commented Apr 17, 2020

EnableNewCops: true seems like a good name, however NewCops accepts three values: enalbe, disable, and pending.

@danielpowell4
Copy link

@danielpowell4 danielpowell4 commented Apr 17, 2020

Thank you thank you thank you

Neodelf added a commit to Neodelf/rubocop that referenced this issue Apr 28, 2020
Resolves rubocop-hq#7850.

This PR will add `--enable-pending-cops` and `--disable-pending-cops`
command-line options and `NewCops` will be provided in .rubocop.yml.

When `NewCops` is `enable`, pending cops are enabled in bulk.

```yaml
AllCops:
  NewCops: enable
```

Can be overridden by the `--enable-pending-cops` command-line option.

When `NewCops` is `disable`, pending cops are disabled in bulk.

```yaml
AllCops:
  NewCops: disable
```

Can be overridden by the `--disable-pending-cops` command-line option.

The default value of `NewCops` is `pending`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.