rubocop-cobra 0.4.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Appraisals +8 -8
- data/CHANGELOG.md +20 -1
- data/Gemfile +0 -5
- data/Gemfile.lock +61 -71
- data/config/default.yml +18 -6
- data/config/obsoletion.yml +5 -0
- data/docs/README.md +4 -2
- data/gemfiles/rails_7_1.gemfile +0 -5
- data/gemfiles/rails_7_1.gemfile.lock +81 -73
- data/gemfiles/rails_7_2.gemfile +0 -5
- data/gemfiles/rails_7_2.gemfile.lock +81 -73
- data/gemfiles/{rails_6_0.gemfile → rails_8_0.gemfile} +1 -3
- data/gemfiles/rails_8_0.gemfile.lock +334 -0
- data/gemfiles/{rails_7_0.gemfile → rails_8_1.gemfile} +1 -6
- data/gemfiles/rails_8_1.gemfile.lock +336 -0
- data/lib/rubocop/cobra/plugin.rb +29 -0
- data/lib/rubocop/cobra/version.rb +1 -1
- data/lib/rubocop/cobra.rb +6 -5
- data/lib/rubocop/cop/cobra/association_class.rb +51 -0
- data/lib/rubocop/cop/cobra/constant_resolution.rb +61 -0
- data/lib/rubocop/cop/cobra/controller_file_placement.rb +8 -10
- data/lib/rubocop/cop/cobra/dependency_version.rb +10 -1
- data/lib/rubocop/cop/cobra/deprecated_constant.rb +196 -0
- data/lib/rubocop/cop/cobra/deprecation_list.rb +46 -0
- data/lib/rubocop/cop/cobra/engine_isolate_namespace.rb +93 -0
- data/lib/rubocop/cop/cobra/file_placement_help.rb +14 -17
- data/lib/rubocop/cop/cobra/gem_requirement.rb +24 -41
- data/lib/rubocop/cop/cobra/inheritance.rb +1 -1
- data/lib/rubocop/cop/cobra/lib_file_placement.rb +2 -2
- data/lib/rubocop/cop/cobra/model_file_placement.rb +8 -10
- data/lib/rubocop/cop/cobra/view_component_file_placement.rb +14 -27
- data/lib/rubocop/cop/cobra_cops.rb +5 -1
- data/lib/rubocop-cobra.rb +0 -3
- data/rubocop-cobra.gemspec +3 -0
- metadata +41 -9
- data/gemfiles/rails_6_0.gemfile.lock +0 -258
- data/gemfiles/rails_6_1.gemfile +0 -17
- data/gemfiles/rails_6_1.gemfile.lock +0 -281
- data/gemfiles/rails_7_0.gemfile.lock +0 -278
- data/lib/rubocop/cobra/inject.rb +0 -20
- data/lib/rubocop/cop/cobra/helper_file_placement.rb +0 -48
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03c327fb1c4b0fe9e5b5c4856b8e6bcbeb5675f00eaf4261b2d29ff6cd2b9b69
|
|
4
|
+
data.tar.gz: d0979cb16b82b638f8ef1279f2046ddd2c4f01f3d05653cf01b6d58926255491
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a7fc3991550cac817267d34155c378d4a315210cae860431fea57c6492b39e145c1d789eeffe256dc0c9e23395850731230e5f2c9b430922175df8d2a673dd2
|
|
7
|
+
data.tar.gz: a0c9477c21304cf3876eb63d7d99810653f54d253859a0a8e47781ca14e199f5859c722b3743364425c654b605b9b25273933c6451599b0639d9d1067611c710
|
data/.rubocop.yml
CHANGED
data/Appraisals
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
appraise "rails-6-1" do
|
|
4
|
-
gem "rails", "6.1.7.7"
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
appraise "rails-7-0" do
|
|
8
|
-
gem "rails", "7.0.8.1"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
3
|
appraise "rails-7-1" do
|
|
12
4
|
gem "rails", "7.1.5.2"
|
|
13
5
|
end
|
|
@@ -15,3 +7,11 @@ end
|
|
|
15
7
|
appraise "rails-7-2" do
|
|
16
8
|
gem "rails", "7.2.2.2"
|
|
17
9
|
end
|
|
10
|
+
|
|
11
|
+
appraise "rails-8-0" do
|
|
12
|
+
gem "rails", "8.0.5"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
appraise "rails-8-1" do
|
|
16
|
+
gem "rails", "8.1.3"
|
|
17
|
+
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.6.0] - 2026-11-23
|
|
4
|
+
|
|
5
|
+
- Add `Cobra/DeprecatedConstant`, which flags references to constants an application lists as deprecated under `Constants` (for example a class that moved into another component), including `class_name:` and `constantize` strings and associations whose class Rails infers from the name. Relative names are resolved through the enclosing namespaces as Ruby and Rails would, associations in concerns are flagged whenever the including model could reach a deprecated class, and serializer and resource classes are skipped. It does nothing until configured
|
|
6
|
+
- Add `Cobra/EngineIsolateNamespace`, which requires every Rails engine to call `isolate_namespace` with the module it is defined in, so its routes, helpers and models stay out of the host application
|
|
7
|
+
- rubocop-cobra is now a RuboCop plugin (lint_roller), replacing the `Inject` config monkey patch. Load it with `plugins: - rubocop-cobra` in `.rubocop.yml`; `require: - rubocop-cobra` still works but RuboCop prints a deprecation warning
|
|
8
|
+
- **Breaking:** Remove `Cobra/HelperFilePlacement`. It told developers to namespace helpers that `Style/NoHelpers` (rubocop-powerhome) says should not exist. Configuration that still names it now fails with a message pointing to `Style/NoHelpers`; delete those entries (e.g. from `.rubocop_todo.yml`)
|
|
9
|
+
- `Cobra/GemRequirement` now checks every `path ".."` block wherever it appears in the Gemfile, including gems nested in a `group` and gems with other options alongside `require: nil`. Previously it only checked a path block that was the last statement in the file
|
|
10
|
+
- Fix `Cobra/Inheritance` allowing a top-level `::ApplicationRecord` (or other protected constant) with a leading `::`
|
|
11
|
+
- Anchor the file placement cops on `components/<name>/<dir>/`. A `lib/` or `components/` elsewhere in the path (a parent directory, a component named `pdf_lib`, `app/lib/`) no longer triggers false offenses, and `Cobra/ViewComponentFilePlacement` ignores files outside a component
|
|
12
|
+
- Run the previously skipped `Cobra/DependencyVersion` spec, and reword its message: it applies to every gemspec dependency, not only external components
|
|
13
|
+
- Fix `rubocop --debug` crashing with `undefined method 'logger' for module RuboCop::Rails`
|
|
14
|
+
|
|
15
|
+
## [0.5.0] - 2026-07-28
|
|
16
|
+
|
|
17
|
+
[HFH-4410 - Bump powertools for Rails 8.1.3 V2](https://github.com/powerhome/power-tools/pull/426)
|
|
18
|
+
|
|
19
|
+
- Upgrade Rails to 8.1.3 for Nitro and Runway compatability
|
|
20
|
+
- Drop support for Ruby < 3.3 and Rails < 7.1 [#396](https://github.com/powerhome/power-tools/pull/396)
|
|
2
21
|
|
|
3
22
|
## [0.4.7] - 2026-01-05
|
|
4
23
|
|
data/Gemfile
CHANGED
|
@@ -5,12 +5,7 @@ source "https://rubygems.org"
|
|
|
5
5
|
# Specify your gem's dependencies in rubocop-cobra.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem "erb", "< 6"
|
|
9
|
-
gem "net-imap", "< 0.5.0"
|
|
10
|
-
gem "nokogiri", "< 1.18.10"
|
|
11
8
|
gem "rake", "~> 13.0"
|
|
12
9
|
gem "rspec", "~> 3.0"
|
|
13
|
-
gem "securerandom", "< 0.4.0"
|
|
14
|
-
gem "zeitwerk", "< 2.7.0"
|
|
15
10
|
|
|
16
11
|
gem "rubocop-powerhome", path: "../rubocop-powerhome"
|
data/Gemfile.lock
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../rubocop-powerhome
|
|
3
3
|
specs:
|
|
4
|
-
rubocop-powerhome (0.
|
|
4
|
+
rubocop-powerhome (0.8.0)
|
|
5
|
+
lint_roller (~> 1.1)
|
|
5
6
|
rubocop (= 1.82.1)
|
|
6
|
-
rubocop-performance
|
|
7
|
-
rubocop-rails
|
|
8
|
-
rubocop-rake
|
|
9
|
-
rubocop-rspec
|
|
7
|
+
rubocop-performance (>= 1.24)
|
|
8
|
+
rubocop-rails (>= 2.28)
|
|
9
|
+
rubocop-rake (>= 0.7)
|
|
10
|
+
rubocop-rspec (>= 3.5)
|
|
10
11
|
|
|
11
12
|
PATH
|
|
12
13
|
remote: .
|
|
13
14
|
specs:
|
|
14
|
-
rubocop-cobra (0.
|
|
15
|
+
rubocop-cobra (0.6.0)
|
|
16
|
+
activesupport (>= 7.1)
|
|
17
|
+
lint_roller (~> 1.1)
|
|
15
18
|
rubocop (= 1.82.1)
|
|
16
19
|
rubocop-powerhome
|
|
17
20
|
|
|
18
21
|
GEM
|
|
19
22
|
remote: https://rubygems.org/
|
|
20
23
|
specs:
|
|
21
|
-
activesupport (8.
|
|
24
|
+
activesupport (8.1.4.1)
|
|
22
25
|
base64
|
|
23
|
-
benchmark (>= 0.3)
|
|
24
26
|
bigdecimal
|
|
25
27
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
26
28
|
connection_pool (>= 2.2.5)
|
|
27
29
|
drb
|
|
28
30
|
i18n (>= 1.6, < 2)
|
|
31
|
+
json
|
|
29
32
|
logger (>= 1.4.2)
|
|
30
33
|
minitest (>= 5.1)
|
|
31
34
|
securerandom (>= 0.3)
|
|
@@ -35,23 +38,20 @@ GEM
|
|
|
35
38
|
bundler
|
|
36
39
|
rake
|
|
37
40
|
thor (>= 0.14.0)
|
|
38
|
-
ast (2.4.
|
|
39
|
-
base64 (0.
|
|
40
|
-
|
|
41
|
-
bigdecimal (3.1.9)
|
|
41
|
+
ast (2.4.3)
|
|
42
|
+
base64 (0.3.0)
|
|
43
|
+
bigdecimal (4.1.3)
|
|
42
44
|
byebug (11.1.3)
|
|
43
45
|
coderay (1.1.3)
|
|
44
|
-
concurrent-ruby (1.3.
|
|
45
|
-
connection_pool (
|
|
46
|
-
csv (3.3.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
erb (5.0.2)
|
|
51
|
-
i18n (1.14.7)
|
|
46
|
+
concurrent-ruby (1.3.8)
|
|
47
|
+
connection_pool (3.0.3)
|
|
48
|
+
csv (3.3.5)
|
|
49
|
+
diff-lcs (1.6.2)
|
|
50
|
+
drb (2.2.3)
|
|
51
|
+
i18n (1.14.8)
|
|
52
52
|
concurrent-ruby (~> 1.0)
|
|
53
|
-
json (2.9
|
|
54
|
-
language_server-protocol (3.17.0.
|
|
53
|
+
json (2.19.9)
|
|
54
|
+
language_server-protocol (3.17.0.5)
|
|
55
55
|
license_finder (7.2.1)
|
|
56
56
|
bundler
|
|
57
57
|
csv (~> 3.2)
|
|
@@ -61,25 +61,16 @@ GEM
|
|
|
61
61
|
with_env (= 1.1.0)
|
|
62
62
|
xml-simple (~> 1.1.9)
|
|
63
63
|
lint_roller (1.1.0)
|
|
64
|
-
logger (1.
|
|
64
|
+
logger (1.7.0)
|
|
65
65
|
method_source (1.1.0)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
net-protocol (0.2.2)
|
|
72
|
-
timeout
|
|
73
|
-
nokogiri (1.18.9)
|
|
74
|
-
mini_portile2 (~> 2.8.2)
|
|
75
|
-
racc (~> 1.4)
|
|
76
|
-
nokogiri (1.18.9-arm64-darwin)
|
|
77
|
-
racc (~> 1.4)
|
|
78
|
-
parallel (1.26.3)
|
|
79
|
-
parser (3.3.9.0)
|
|
66
|
+
minitest (6.0.6)
|
|
67
|
+
drb (~> 2.0)
|
|
68
|
+
prism (~> 1.5)
|
|
69
|
+
parallel (1.28.0)
|
|
70
|
+
parser (3.3.11.1)
|
|
80
71
|
ast (~> 2.4.1)
|
|
81
72
|
racc
|
|
82
|
-
prism (1.
|
|
73
|
+
prism (1.9.0)
|
|
83
74
|
pry (0.14.2)
|
|
84
75
|
coderay (~> 1.1)
|
|
85
76
|
method_source (~> 1.0)
|
|
@@ -87,24 +78,24 @@ GEM
|
|
|
87
78
|
byebug (~> 11.0)
|
|
88
79
|
pry (>= 0.13, < 0.15)
|
|
89
80
|
racc (1.8.1)
|
|
90
|
-
rack (3.
|
|
81
|
+
rack (3.2.6)
|
|
91
82
|
rainbow (3.1.1)
|
|
92
|
-
rake (13.
|
|
93
|
-
regexp_parser (2.
|
|
94
|
-
rexml (3.4.
|
|
95
|
-
rspec (3.13.
|
|
83
|
+
rake (13.3.1)
|
|
84
|
+
regexp_parser (2.12.0)
|
|
85
|
+
rexml (3.4.4)
|
|
86
|
+
rspec (3.13.2)
|
|
96
87
|
rspec-core (~> 3.13.0)
|
|
97
88
|
rspec-expectations (~> 3.13.0)
|
|
98
89
|
rspec-mocks (~> 3.13.0)
|
|
99
|
-
rspec-core (3.13.
|
|
90
|
+
rspec-core (3.13.6)
|
|
100
91
|
rspec-support (~> 3.13.0)
|
|
101
|
-
rspec-expectations (3.13.
|
|
92
|
+
rspec-expectations (3.13.5)
|
|
102
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
103
94
|
rspec-support (~> 3.13.0)
|
|
104
|
-
rspec-mocks (3.13.
|
|
95
|
+
rspec-mocks (3.13.8)
|
|
105
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
106
97
|
rspec-support (~> 3.13.0)
|
|
107
|
-
rspec-support (3.13.
|
|
98
|
+
rspec-support (3.13.7)
|
|
108
99
|
rubocop (1.82.1)
|
|
109
100
|
json (~> 2.3)
|
|
110
101
|
language_server-protocol (~> 3.17.0.2)
|
|
@@ -116,35 +107,39 @@ GEM
|
|
|
116
107
|
rubocop-ast (>= 1.48.0, < 2.0)
|
|
117
108
|
ruby-progressbar (~> 1.7)
|
|
118
109
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
119
|
-
rubocop-ast (1.
|
|
110
|
+
rubocop-ast (1.49.1)
|
|
120
111
|
parser (>= 3.3.7.2)
|
|
121
|
-
prism (~> 1.
|
|
122
|
-
rubocop-performance (1.
|
|
123
|
-
|
|
124
|
-
rubocop
|
|
125
|
-
|
|
112
|
+
prism (~> 1.7)
|
|
113
|
+
rubocop-performance (1.26.1)
|
|
114
|
+
lint_roller (~> 1.1)
|
|
115
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
116
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
117
|
+
rubocop-rails (2.34.3)
|
|
126
118
|
activesupport (>= 4.2.0)
|
|
119
|
+
lint_roller (~> 1.1)
|
|
127
120
|
rack (>= 1.1)
|
|
128
|
-
rubocop (>= 1.
|
|
129
|
-
rubocop-ast (>= 1.
|
|
130
|
-
rubocop-rake (0.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
122
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
|
123
|
+
rubocop-rake (0.7.1)
|
|
124
|
+
lint_roller (~> 1.1)
|
|
125
|
+
rubocop (>= 1.72.1)
|
|
126
|
+
rubocop-rspec (3.9.0)
|
|
127
|
+
lint_roller (~> 1.1)
|
|
128
|
+
rubocop (~> 1.81)
|
|
134
129
|
ruby-progressbar (1.13.0)
|
|
135
130
|
rubyzip (2.4.1)
|
|
136
|
-
securerandom (0.
|
|
137
|
-
thor (1.
|
|
138
|
-
|
|
139
|
-
tomlrb (2.0.3)
|
|
131
|
+
securerandom (0.4.1)
|
|
132
|
+
thor (1.5.0)
|
|
133
|
+
tomlrb (2.0.4)
|
|
140
134
|
tzinfo (2.0.6)
|
|
141
135
|
concurrent-ruby (~> 1.0)
|
|
142
|
-
unicode-display_width (2.
|
|
143
|
-
|
|
136
|
+
unicode-display_width (3.2.0)
|
|
137
|
+
unicode-emoji (~> 4.1)
|
|
138
|
+
unicode-emoji (4.2.0)
|
|
139
|
+
uri (1.1.2)
|
|
144
140
|
with_env (1.1.0)
|
|
145
141
|
xml-simple (1.1.9)
|
|
146
142
|
rexml
|
|
147
|
-
zeitwerk (2.6.18)
|
|
148
143
|
|
|
149
144
|
PLATFORMS
|
|
150
145
|
arm64-darwin-24
|
|
@@ -152,18 +147,13 @@ PLATFORMS
|
|
|
152
147
|
|
|
153
148
|
DEPENDENCIES
|
|
154
149
|
appraisal (~> 2.5.0)
|
|
155
|
-
erb (< 6)
|
|
156
150
|
license_finder (~> 7.0)
|
|
157
|
-
net-imap (< 0.5.0)
|
|
158
|
-
nokogiri (< 1.18.10)
|
|
159
151
|
pry (>= 0.14.2)
|
|
160
152
|
pry-byebug (= 3.10.1)
|
|
161
153
|
rake (~> 13.0)
|
|
162
154
|
rspec (~> 3.0)
|
|
163
155
|
rubocop-cobra!
|
|
164
156
|
rubocop-powerhome!
|
|
165
|
-
securerandom (< 0.4.0)
|
|
166
|
-
zeitwerk (< 2.7.0)
|
|
167
157
|
|
|
168
158
|
BUNDLED WITH
|
|
169
159
|
2.5.23
|
data/config/default.yml
CHANGED
|
@@ -12,17 +12,29 @@ Cobra/ControllerFilePlacement:
|
|
|
12
12
|
VersionAdded: '0.1.0'
|
|
13
13
|
|
|
14
14
|
Cobra/DependencyVersion:
|
|
15
|
-
Description: '
|
|
15
|
+
Description: 'Gemspec dependencies should be declared with a version'
|
|
16
16
|
Enabled: true
|
|
17
17
|
VersionAdded: '0.1.0'
|
|
18
18
|
|
|
19
|
-
Cobra/
|
|
20
|
-
Description: '
|
|
19
|
+
Cobra/DeprecatedConstant:
|
|
20
|
+
Description: 'Flags references to constants the application has deprecated, such as a class left behind as a shim after moving to another component.'
|
|
21
21
|
Enabled: true
|
|
22
|
-
VersionAdded: '0.
|
|
22
|
+
VersionAdded: '0.6.0'
|
|
23
|
+
# The replacement only behaves the same once the deprecated class is a bare
|
|
24
|
+
# shim, so autocorrect runs only with `rubocop -A`.
|
|
25
|
+
SafeAutoCorrect: false
|
|
26
|
+
# Each deprecated constant mapped to its replacement, e.g.
|
|
27
|
+
# Territory: Directory::Territory
|
|
28
|
+
# The cop does nothing until the application lists at least one.
|
|
29
|
+
Constants: {}
|
|
23
30
|
|
|
24
|
-
Cobra/
|
|
25
|
-
Description: '
|
|
31
|
+
Cobra/EngineIsolateNamespace:
|
|
32
|
+
Description: 'Rails engines must call `isolate_namespace` with their own namespace'
|
|
33
|
+
Enabled: true
|
|
34
|
+
VersionAdded: '0.6.0'
|
|
35
|
+
|
|
36
|
+
Cobra/GemRequirement:
|
|
37
|
+
Description: 'Component Gemfile dependencies must specify "require: nil"'
|
|
26
38
|
Enabled: true
|
|
27
39
|
VersionAdded: '0.1.0'
|
|
28
40
|
|
data/docs/README.md
CHANGED
|
@@ -16,13 +16,15 @@ And then execute:
|
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
|
-
Add
|
|
19
|
+
Add the plugin to your `.rubocop.yml`:
|
|
20
20
|
|
|
21
21
|
```yml
|
|
22
|
-
|
|
22
|
+
plugins:
|
|
23
23
|
- rubocop-cobra
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
rubocop-cobra is a [RuboCop plugin](https://docs.rubocop.org/rubocop/plugin_migration_guide.html), so it needs RuboCop 1.72 or newer. Listing it under `require:` still works but RuboCop prints a deprecation warning.
|
|
27
|
+
|
|
26
28
|
That's it! You can override the standard configuration after that.
|
|
27
29
|
|
|
28
30
|
## Development
|
data/gemfiles/rails_7_1.gemfile
CHANGED
|
@@ -4,14 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
source "https://rubygems.org"
|
|
6
6
|
|
|
7
|
-
gem "erb", "< 6"
|
|
8
|
-
gem "net-imap", "< 0.5.0"
|
|
9
|
-
gem "nokogiri", "< 1.18.10"
|
|
10
7
|
gem "rails", "7.1.5.2"
|
|
11
8
|
gem "rake", "~> 13.0"
|
|
12
9
|
gem "rspec", "~> 3.0"
|
|
13
10
|
gem "rubocop-powerhome", path: "../../rubocop-powerhome"
|
|
14
|
-
gem "securerandom", "< 0.4.0"
|
|
15
|
-
gem "zeitwerk", "< 2.7.0"
|
|
16
11
|
|
|
17
12
|
gemspec path: "../"
|