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

[N/A] Convert gem to be a rubocop extension #119

Merged
merged 5 commits into from
Oct 2, 2023

Conversation

jivdhaliwal
Copy link
Contributor

Updates the gem to follow the conventions in https://github.com/rubocop/rubocop-extension-generator which is used to generate all of the rubocop gems we use (rubocop-rspec, rubocop-rails, rubocop-performance, etc).

Converting the gem to a rubocop extension allows us to use the boxt_rubocop rubocop config by simply requiring it as we do other rubocop gems:

require:
  - boxt_rubocop

It also has the added benefit of having proper support for custom cops. This means that we can now create custom cops without having to worry about manually disabling them in every project we don't want to use them in.

I have left the rails.yml and rspec.yml configs as separate files that can be imported individually using inherit_gem:

inherit_gem:
  boxt_rubocop:
    - rails.yml
    - rspec.yml

If we decide that any of these configs should be enabled by default we can simply move them in to config/default.yml.

@jivdhaliwal jivdhaliwal force-pushed the convert-gem-to-rubocop-extension branch from 489636c to 00dbb8e Compare September 29, 2023 14:40
@jivdhaliwal jivdhaliwal requested a review from schinery October 2, 2023 08:35
@jivdhaliwal jivdhaliwal marked this pull request as ready for review October 2, 2023 08:35
@jivdhaliwal jivdhaliwal requested a review from schinery October 2, 2023 09:53
Revert back to the original implementation for removing new lines and avoid
any issues if there are extra characters on the new line.

module RuboCop
module Boxt
VERSION = File.read(File.join(File.dirname(__FILE__), "../../../VERSION")).split("\n").first
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was struggling to find the VERSION file when running rubocop in our danger workflow directory so I updated it to use a relative path @schinery

Copy link
Contributor

@faheemmughal faheemmughal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NASA LGTM

@jivdhaliwal jivdhaliwal merged commit b1a09a4 into main Oct 2, 2023
1 check passed
@jivdhaliwal jivdhaliwal deleted the convert-gem-to-rubocop-extension branch October 2, 2023 10:52
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.

3 participants