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

[Fix #9122] Added notification if any gems are loaded that have rubocop extensions. #9130

Merged
merged 1 commit into from
Dec 1, 2020

Conversation

dvandersluis
Copy link
Member

@dvandersluis dvandersluis commented Nov 30, 2020

The notification is output at the end, and only when using a few specified formatters that make sense to me. It is also disabled for CI and if some rubocop options are set that I didn't think it made sense to be included for (--only, --debug, --list-target-files and --out (since this is possibly used for something programmatic, I didn't want to change it).

The message looks like this:

Notice: Based on detected gems, the following RuboCop extension libraries might be helpful:
  * rubocop-rake (http://github.com/rubocop-hq/rubocop-rake)

This notification can be disabled by adding this to your config:
  AllCops:
    NotifyForExtensions: false

I also wanted to have a way to disable it so that it doesn't end up being spammy to users who aren't interested, so it is configured by AllCops/NotifyForExtensions (which can either take a hash of extensions and gems, or false). I did it this way so that someone could disable the notification for just rubocop-rake for instance, if they're never planning on using it.

I would love to discuss any choices I made and make any changes!


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • 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.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@dvandersluis
Copy link
Member Author

/cc @bbatsov @tejasbubane

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 1, 2020

I love the proposed design and I might even ship this with the release I've planned for later today, as I don't really have any concerns about it. It's actually better than what I had in mind, as originally I was thinking of mapping extensions to the presence of certain files/folders in the project. You came up with a granular and flexible configuration and I agree that something like this doesn't make sense for every formatter.

I'm assuming in the unlikely event of a project with only a .gemspec we might run into some issues, but that's not a big deal. As far as I'm concerned all we need is some documentation is this is pure gold. Thanks! 🙇

@dvandersluis
Copy link
Member Author

@bbatsov thanks! My biggest worry is how to make this be useful without being spammy.

I'll write up some documentation for it in the morning, thanks for the reminder!

config/default.yml Outdated Show resolved Hide resolved
…e rubocop extensions.

The notification can be disabled by setting `AllCops/SuggestExtensions: false`
@dvandersluis
Copy link
Member Author

@bbatsov oh I was writing tests and documentation 😅 I'll open another PR

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

2 participants