-
Notifications
You must be signed in to change notification settings - Fork 48
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
Explore plugin configs #498
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
"config change": rubocop.yml | ||
"config change": rubocop*.yml | ||
"hq": rubocop.yml | ||
"graphql": rubocop.graphql.yml | ||
"minitest": rubocop.minitest.yml | ||
"performance": rubocop.performance.yml | ||
"rails": rubocop.rails.yml | ||
"rake": rubocop.rake.yml | ||
"rspec": rubocop.rspec.yml |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,12 @@ gem "diffy" | |
gem "minitest" | ||
gem "pry-byebug" | ||
gem "rake" | ||
|
||
group :plugins do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could use this to skip installing these in one of our CI runs, so we can ensure everything still works for consumers only using RuboCop. |
||
gem "rubocop-graphql" | ||
gem "rubocop-minitest" | ||
gem "rubocop-performance" | ||
gem "rubocop-rails" | ||
gem "rubocop-rake" | ||
gem "rubocop-rspec" | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Minitest: | ||
Enabled: true | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't bothered filling out most of these files, but presumably they'd look like: PluginName:
Enabled: true
# ...config for cops where we want to diverge from the default... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could alternatively call these after the gem names (e.g. I just went with what we use in Core. 🤷 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to not use defaults. Let's always curate cops. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,22 @@ inherit_mode: | |
- Exclude | ||
- Include | ||
|
||
<% | ||
# Identify installed RuboCop plugins to configure | ||
plugin_configs = { | ||
"rubocop-graphql" => "rubocop.graphql.yml", | ||
"rubocop-minitest" => "rubocop.minitest.yml", | ||
"rubocop-performance" => "rubocop.performance.yml", | ||
"rubocop-rails" => "rubocop.rails.yml", | ||
"rubocop-rake" => "rubocop.graphql.yml", | ||
"rubocop-rspec" => "rubocop.rspec.yml", | ||
}.select { |plugin_name, _| Gem.loaded_specs.include?(plugin_name) } | ||
%> | ||
|
||
require: <%= plugin_configs.keys.to_json %> | ||
|
||
inherit_from: <%= plugin_configs.values.to_json %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is where the magic happens. 🪄 ✨ 👮♂️ Are there reasons why this would be a bad idea? Pros
Cons
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tentatively moved this into inherit_gem:
rubocop-shopify: rubocop.infer.yml # or perhaps we call it `rubocop.shopify.yml` or stick with the current minimal approach: inherit_gem
rubocop-shopify: rubocop.yml or take a custom approach inherit_gem
rubocop-shopify:
- rubocop.yml
- rubocop.rails.yml |
||
|
||
AllCops: | ||
StyleGuideBaseURL: https://shopify.github.io/ruby-style-guide/ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure of a good label name, so I went with the "cop" analogy of headquarters. 🤷