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

Display version with cop added when pending cops warning #7765

Merged
merged 1 commit into from Feb 29, 2020

Conversation

koic
Copy link
Member

@koic koic commented Feb 28, 2020

Follow up of #7757 (comment).

When warning about a pending cop, this PR displays the version with the cop added.

Before

% rubocop
The following cops were added to RuboCop, but are not configured. Please
set Enabled to either `true` or `false` in your `.rubocop.yml` file:
 - Style/HashEachMethods
 - Style/HashTransformKeys
 - Style/HashTransformValues

After

% rubocop
The following cops were added to RuboCop, but are not configured. Please
set Enabled to either `true` or `false` in your `.rubocop.yml` file:
 - Style/HashEachMethods (0.80)
 - Style/HashTransformKeys (0.80)
 - Style/HashTransformValues (0.80)
For more information: https://docs.rubocop.org/en/latest/versioning/

Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@koic koic force-pushed the display_version_with_cop_added branch from fbb3c8a to b8910a5 Compare February 28, 2020 03:24
@pocke
Copy link
Collaborator

pocke commented Feb 28, 2020

It looks a good improvement!

By the way, recently I've got a feedback about the feature from @znz.
He said it would be better if it displays the configurations. For example:

$ rubocop
The following cops were added to RuboCop, but are not configured. Please
set Enabled to either `true` or `false` in your `.rubocop.yml` file:
Style/HashEachMethods:
 VersionAdded: 0.80
 # Enabled: true/false # Confiure it!
Style/HashTransformKeys:
 VersionAdded: 0.80
 # Enabled: true/false # Confiure it!
Style/HashTransformValues:
 VersionAdded: 0.80
 # Enabled: true/false # Confiure it!

I think it is reasonable because the users can configure the new cops easier.
But I concern that it will be too long.
What do you think?

@bbatsov
Copy link
Collaborator

bbatsov commented Feb 29, 2020

  • Style/HashEachMethods cop added by 0.80

I think a better format would be "Cop (added in version)".

Might also be a good idea to add a link to the manual (https://docs.rubocop.org/en/latest/versioning/) at the end of the message, as it seems it confused some users.

I'd add to this page an example message and probably some configuration snippet (as suggested by @pocke), so it's easier for users to figure out what how to deal with the message.

Follow up of rubocop#7757 (comment).

When warning about a pending cop, this PR displays the version with the cop added.

## Before

```console
% rubocop
The following cops were added to RuboCop, but are not configured. Please
set Enabled to either `true` or `false` in your `.rubocop.yml` file:
 - Style/HashEachMethods
 - Style/HashTransformKeys
 - Style/HashTransformValues
```

## After

```console
% rubocop
The following cops were added to RuboCop, but are not configured. Please
set Enabled to either `true` or `false` in your `.rubocop.yml` file:
 - Style/HashEachMethods (0.80)
 - Style/HashTransformKeys (0.80)
 - Style/HashTransformValues (0.80)
For more information: https://docs.rubocop.org/en/latest/versioning/
```
@koic koic force-pushed the display_version_with_cop_added branch from b8910a5 to 20350e8 Compare February 29, 2020 16:20
@koic
Copy link
Member Author

koic commented Feb 29, 2020

@bbatsov @pocke Thanks for the feedback.

I think a better format would be "Cop (added in version)".

Might also be a good idea to add a link to the manual (https://docs.rubocop.org/en/latest/versioning/) at the end of the message, as it seems it confused some users.

I updated the warning message and the versioning manual.

@bbatsov bbatsov merged commit bd6c945 into rubocop:master Feb 29, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Feb 29, 2020

Great work! 🙇

@koic koic deleted the display_version_with_cop_added branch February 29, 2020 16:52
@koic
Copy link
Member Author

koic commented Feb 29, 2020

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants