Skip to content

Commit 5d617fc

Browse files
committed
[WIP] Explore plugin configs
- RuboCop config requires only the RuboCop plugins whose gemspec is loaded - Each plugin has a corresponding file of defaults which are inherited - Labels are attached automatically to PRs touching each config file TBD: - Should we have a minimal config? Should we keep the existing config as is, and instead add an "everything.yml" config? - Should we test compatibility with _just_ RuboCop and no plugins? - What cops to enable? Maybe disallowing "pending" shouldn't apply to plugins, so we don't break consumers?
1 parent 53be4b4 commit 5d617fc

File tree

11 files changed

+2696
-4
lines changed

11 files changed

+2696
-4
lines changed

.github/labeler.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
"config change": rubocop.yml
1+
"config change": rubocop*.yml
2+
"hq": rubocop.yml
3+
"graphql": rubocop.graphql.yml
4+
"minitest": rubocop.minitest.yml
5+
"performance": rubocop.performance.yml
6+
"rails": rubocop.rails.yml
7+
"rake": rubocop.rake.yml
8+
"rspec": rubocop.rspec.yml

Gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@ gem "diffy"
88
gem "minitest"
99
gem "pry-byebug"
1010
gem "rake"
11+
12+
group :plugins do
13+
gem "rubocop-graphql"
14+
gem "rubocop-minitest"
15+
gem "rubocop-performance"
16+
gem "rubocop-rails"
17+
gem "rubocop-rake"
18+
gem "rubocop-rspec"
19+
end

Gemfile.lock

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ PATH
77
GEM
88
remote: https://rubygems.org/
99
specs:
10+
activesupport (7.0.4.2)
11+
concurrent-ruby (~> 1.0, >= 1.0.2)
12+
i18n (>= 1.6, < 2)
13+
minitest (>= 5.1)
14+
tzinfo (~> 2.0)
1015
ast (2.4.2)
1116
byebug (11.1.3)
1217
coderay (1.1.3)
18+
concurrent-ruby (1.2.0)
1319
diffy (3.4.2)
20+
i18n (1.12.0)
21+
concurrent-ruby (~> 1.0)
1422
json (2.6.3)
1523
method_source (1.0.0)
1624
minitest (5.17.0)
@@ -23,6 +31,7 @@ GEM
2331
pry-byebug (3.10.1)
2432
byebug (~> 11.0)
2533
pry (>= 0.13, < 0.15)
34+
rack (3.0.4.1)
2635
rainbow (3.1.1)
2736
rake (13.0.6)
2837
regexp_parser (2.6.2)
@@ -39,7 +48,27 @@ GEM
3948
unicode-display_width (>= 2.4.0, < 3.0)
4049
rubocop-ast (1.24.1)
4150
parser (>= 3.1.1.0)
51+
rubocop-capybara (2.17.0)
52+
rubocop (~> 1.41)
53+
rubocop-graphql (0.19.0)
54+
rubocop (>= 0.87, < 2)
55+
rubocop-minitest (0.27.0)
56+
rubocop (>= 0.90, < 2.0)
57+
rubocop-performance (1.16.0)
58+
rubocop (>= 1.7.0, < 2.0)
59+
rubocop-ast (>= 0.4.0)
60+
rubocop-rails (2.17.4)
61+
activesupport (>= 4.2.0)
62+
rack (>= 1.1)
63+
rubocop (>= 1.33.0, < 2.0)
64+
rubocop-rake (0.6.0)
65+
rubocop (~> 1.0)
66+
rubocop-rspec (2.18.1)
67+
rubocop (~> 1.33)
68+
rubocop-capybara (~> 2.17)
4269
ruby-progressbar (1.11.0)
70+
tzinfo (2.0.6)
71+
concurrent-ruby (~> 1.0)
4372
unicode-display_width (2.4.2)
4473

4574
PLATFORMS
@@ -50,6 +79,12 @@ DEPENDENCIES
5079
minitest
5180
pry-byebug
5281
rake
82+
rubocop-graphql
83+
rubocop-minitest
84+
rubocop-performance
85+
rubocop-rails
86+
rubocop-rake
87+
rubocop-rspec
5388
rubocop-shopify!
5489

5590
BUNDLED WITH

rubocop.graphql.yml

Whitespace-only changes.

rubocop.minitest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Minitest:
2+
Enabled: true

rubocop.performance.yml

Whitespace-only changes.

rubocop.rails.yml

Whitespace-only changes.

rubocop.rake.yml

Whitespace-only changes.

rubocop.rspec.yml

Whitespace-only changes.

rubocop.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ inherit_mode:
33
- Exclude
44
- Include
55

6+
<%
7+
# Identify installed RuboCop plugins to configure
8+
plugin_configs = {
9+
"rubocop-graphql" => "rubocop.graphql.yml",
10+
"rubocop-minitest" => "rubocop.minitest.yml",
11+
"rubocop-performance" => "rubocop.performance.yml",
12+
"rubocop-rails" => "rubocop.rails.yml",
13+
"rubocop-rake" => "rubocop.graphql.yml",
14+
"rubocop-rspec" => "rubocop.rspec.yml",
15+
}.select { |plugin_name, _| Gem.loaded_specs.include?(plugin_name) }
16+
%>
17+
18+
require: <%= plugin_configs.keys.to_json %>
19+
20+
inherit_from: <%= plugin_configs.values.to_json %>
21+
622
AllCops:
723
StyleGuideBaseURL: https://shopify.github.io/ruby-style-guide/
824

0 commit comments

Comments
 (0)