nucop 0.10.3 → 0.11.1
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/lib/nucop/cli.rb +18 -16
- data/lib/nucop/cops/release_toggles_use_symbols.rb +1 -1
- data/lib/nucop/helpers/cop_counter.rb +1 -1
- data/lib/nucop/helpers/rubocop_gem_dependencies.rb +24 -0
- data/lib/nucop/version.rb +1 -1
- metadata +53 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 957aed91fcda974f755014f939640d68c6a386b9c6a8df9ffb10a663302d3b6f
|
4
|
+
data.tar.gz: 532a3c3d3fd5b3814243fe9b71440e0ea37ba7e55b705f3c9dfe2a7a6190660b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 952c7cddb1ab8bfb14e9fc9fb7d99058d21c5e77fc95317c45bc593771b89fee3464a966d8eaec00c076f4dbf372eeab6d4cd79093de2a495b45ae25a9094a44
|
7
|
+
data.tar.gz: 875d3e24c5347da87979e8c92f6abf9e7b96323c61e2025b46df6cc3378530a690f4c6c951dbd841e274fa27ba42c26f71a918846655609d08befe34ef92dac3
|
data/lib/nucop/cli.rb
CHANGED
@@ -15,6 +15,7 @@ module Nucop
|
|
15
15
|
method_option "autocorrect-all", type: :boolean, default: false, desc: "runs RuboCop with autocorrect-all option"
|
16
16
|
method_option "junit_report", type: :string, default: nil, desc: "runs RuboCop with junit formatter option"
|
17
17
|
method_option "json", type: :string, default: nil, desc: "Output results as JSON format to the provided file"
|
18
|
+
|
18
19
|
def diff_enforced
|
19
20
|
invoke :diff, nil, options.merge(only: cops_to_enforce.join(","))
|
20
21
|
end
|
@@ -27,6 +28,7 @@ module Nucop
|
|
27
28
|
method_option "autocorrect-all", type: :boolean, default: false, desc: "runs RuboCop with autocorrect-all option"
|
28
29
|
method_option "junit_report", type: :string, default: nil, desc: "runs RuboCop with junit formatter option"
|
29
30
|
method_option "json", type: :string, default: nil, desc: "Output results as JSON format to the provided file"
|
31
|
+
|
30
32
|
def diff_enforced_github
|
31
33
|
invoke :diff_github, nil, options.merge(only: cops_to_enforce.join(","))
|
32
34
|
end
|
@@ -40,6 +42,7 @@ module Nucop
|
|
40
42
|
method_option "ignore", type: :boolean, default: true, desc: "ignores files specified in #{options[:diffignore_file]}"
|
41
43
|
method_option "added-only", type: :boolean, default: false, desc: "runs RuboCop only on files that have been added (not on files that have been modified)"
|
42
44
|
method_option "exit", type: :boolean, default: true, desc: "disable to prevent task from exiting. Used by other Thor tasks when invoking this task, to prevent parent task from exiting"
|
45
|
+
|
43
46
|
def diff
|
44
47
|
puts "Running on files changed relative to '#{options[:"commit-spec"]}' (specify using the 'commit-spec' option)"
|
45
48
|
diff_filter = options[:"added-only"] ? "A" : "d"
|
@@ -88,6 +91,7 @@ module Nucop
|
|
88
91
|
method_option "ignore", type: :boolean, default: true, desc: "ignores files specified in #{options[:diffignore_file]}"
|
89
92
|
method_option "added-only", type: :boolean, default: false, desc: "runs RuboCop only on files that have been added (not on files that have been modified)"
|
90
93
|
method_option "exit", type: :boolean, default: true, desc: "disable to prevent task from exiting. Used by other Thor tasks when invoking this task, to prevent parent task from exiting"
|
94
|
+
|
91
95
|
def diff_github
|
92
96
|
puts "Running on files changed relative to '#{options[:"commit-spec"]}' (specify using the 'commit-spec' option)"
|
93
97
|
diff_head = capture_std_out("git rev-parse HEAD").chomp
|
@@ -155,14 +159,10 @@ module Nucop
|
|
155
159
|
method_option "autocorrect", type: :boolean, default: false, desc: "runs RuboCop with autocorrect option"
|
156
160
|
method_option "autocorrect-all", type: :boolean, default: false, desc: "runs RuboCop with autocorrect-all option"
|
157
161
|
method_option "exclude-backlog", type: :boolean, default: false, desc: "when true, uses config which excludes violations in the RuboCop backlog"
|
162
|
+
|
158
163
|
def rubocop(files = nil)
|
159
164
|
print_cops_being_run(options[:only])
|
160
165
|
config_file = options[:"exclude-backlog"] ? RUBOCOP_DEFAULT_CONFIG_FILE : options[:rubocop_todo_config_file]
|
161
|
-
rubocop_requires = [
|
162
|
-
"--require rubocop-rspec",
|
163
|
-
"--require rubocop-performance",
|
164
|
-
"--require rubocop-rails"
|
165
|
-
]
|
166
166
|
|
167
167
|
formatters = []
|
168
168
|
formatters << "--format Nucop::Formatters::JUnitFormatter --out #{options[:junit_report]}" if options[:junit_report]
|
@@ -173,7 +173,7 @@ module Nucop
|
|
173
173
|
"bundle exec rubocop",
|
174
174
|
"--no-server",
|
175
175
|
"--parallel",
|
176
|
-
|
176
|
+
rubocop_gem_requires.join(" "),
|
177
177
|
formatters.join(" "),
|
178
178
|
"--force-exclusion",
|
179
179
|
"--config", config_file,
|
@@ -189,18 +189,21 @@ module Nucop
|
|
189
189
|
|
190
190
|
desc "regen_backlog", "update the RuboCop backlog, disabling offending files and excluding all cops with over 500 violating files."
|
191
191
|
method_option "exclude-limit", type: :numeric, default: 500, desc: "Limit files listed to this limit. Passed to RuboCop"
|
192
|
+
|
192
193
|
def regen_backlog
|
193
194
|
regenerate_rubocop_todos
|
194
195
|
update_enforced_cops
|
195
196
|
end
|
196
197
|
|
197
198
|
desc "update_enforced", "update the enforced cops list with file with cops that no longer have violations"
|
199
|
+
|
198
200
|
def update_enforced
|
199
201
|
update_enforced_cops
|
200
202
|
end
|
201
203
|
|
202
204
|
desc "modified_lines", "display RuboCop violations for ONLY modified lines"
|
203
205
|
method_option "commit-spec", default: "main", desc: "the commit used to determine the diff."
|
206
|
+
|
204
207
|
def modified_lines
|
205
208
|
diff_files, diff_status = Open3.capture2("git diff #{options[:"commit-spec"]} --diff-filter=d --name-only | grep \"\\.rb$\"")
|
206
209
|
|
@@ -220,6 +223,7 @@ module Nucop
|
|
220
223
|
|
221
224
|
desc "ready_for_promotion", "display the next n cops with the fewest offenses"
|
222
225
|
method_option "n", type: :numeric, default: 1, desc: "number of cops to display"
|
226
|
+
|
223
227
|
def ready_for_promotion
|
224
228
|
finder = Helpers::NextCopForPromotion.new(options[:rubocop_todo_file])
|
225
229
|
todo_config = YAML.load_file(options[:rubocop_todo_file])
|
@@ -303,17 +307,10 @@ module Nucop
|
|
303
307
|
rubocop_options = [
|
304
308
|
"--auto-gen-config",
|
305
309
|
"--config #{options[:rubocop_todo_config_file]}",
|
306
|
-
"--exclude-limit #{options[:"exclude-limit"]}"
|
307
|
-
"--require rubocop-graphql",
|
308
|
-
"--require rubocop-performance",
|
309
|
-
"--require rubocop-rails",
|
310
|
-
"--require rubocop-rake",
|
311
|
-
"--require rubocop-rspec",
|
312
|
-
"--require rubocop-rubycw",
|
313
|
-
"--require rubocop-thread_safety"
|
310
|
+
"--exclude-limit #{options[:"exclude-limit"]}"
|
314
311
|
]
|
315
312
|
|
316
|
-
rubocop_command = "DISABLE_SPRING=1 bundle exec rubocop #{rubocop_options.join(' ')}"
|
313
|
+
rubocop_command = "DISABLE_SPRING=1 bundle exec rubocop #{rubocop_options.join(' ')} #{rubocop_gem_requires.join(' ')}"
|
317
314
|
|
318
315
|
system(rubocop_command)
|
319
316
|
|
@@ -323,6 +320,10 @@ module Nucop
|
|
323
320
|
system("git checkout #{options[:rubocop_todo_config_file]}")
|
324
321
|
end
|
325
322
|
|
323
|
+
def rubocop_gem_requires
|
324
|
+
Nucop::Helpers::RubocopGemDependencies.rubocop_gems.map { |rubocop_gem| "--require #{rubocop_gem}" }
|
325
|
+
end
|
326
|
+
|
326
327
|
def update_enforced_cops
|
327
328
|
puts "Updating enforced cops list..."
|
328
329
|
|
@@ -346,7 +347,8 @@ module Nucop
|
|
346
347
|
end
|
347
348
|
|
348
349
|
def enabled_cops
|
349
|
-
YAML
|
350
|
+
YAML
|
351
|
+
.safe_load(`bundle exec rubocop --parallel --show-cops`, permitted_classes: [Regexp, Symbol])
|
350
352
|
.select { |_, config| config["Enabled"] }
|
351
353
|
.map(&:first)
|
352
354
|
end
|
@@ -17,7 +17,7 @@ module Nucop
|
|
17
17
|
# release_toggle_enabled?(:move_out_of_wip_autocomplete)
|
18
18
|
#
|
19
19
|
class ReleaseTogglesUseSymbols < ::RuboCop::Cop::Cop
|
20
|
-
MSG = "Use a symbol when
|
20
|
+
MSG = "Use a symbol when referring to a Release Toggle's by name".freeze
|
21
21
|
|
22
22
|
def_node_matcher :test_helper?, <<~PATTERN
|
23
23
|
(send nil? {:release_toggle_enabled? :release_toggle_enabled_for_any_site?} (str _))
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Nucop
|
2
|
+
module Helpers
|
3
|
+
# Knows the list of gems the nucop makes available.
|
4
|
+
module RubocopGemDependencies
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def rubocop_gems
|
8
|
+
%w[
|
9
|
+
rubocop
|
10
|
+
rubocop-capybara
|
11
|
+
rubocop-factory_bot
|
12
|
+
rubocop-graphql
|
13
|
+
rubocop-performance
|
14
|
+
rubocop-rails
|
15
|
+
rubocop-rake
|
16
|
+
rubocop-rspec
|
17
|
+
rubocop-rspec_rails
|
18
|
+
rubocop-rubycw
|
19
|
+
rubocop-thread_safety
|
20
|
+
]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/nucop/version.rb
CHANGED
metadata
CHANGED
@@ -1,99 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nucop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Schweier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rubocop
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.64'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.64'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: rubocop
|
28
|
+
name: rubocop-capybara
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.21'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.21'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-factory_bot
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
47
|
+
version: '2.26'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
54
|
+
version: '2.26'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop-graphql
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.5'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop-performance
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
75
|
+
version: '1.21'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
82
|
+
version: '1.21'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop-rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '2.
|
89
|
+
version: '2.25'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '2.
|
96
|
+
version: '2.25'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop-rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,28 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '3.0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rspec_rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.30'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.30'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: rubocop-rubycw
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +164,20 @@ dependencies:
|
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0.5'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: git_diff_parser
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '4.0'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '4.0'
|
153
181
|
- !ruby/object:Gem::Dependency
|
154
182
|
name: ruby-progressbar
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,28 +198,28 @@ dependencies:
|
|
170
198
|
requirements:
|
171
199
|
- - "~>"
|
172
200
|
- !ruby/object:Gem::Version
|
173
|
-
version: '13.
|
201
|
+
version: '13.2'
|
174
202
|
type: :development
|
175
203
|
prerelease: false
|
176
204
|
version_requirements: !ruby/object:Gem::Requirement
|
177
205
|
requirements:
|
178
206
|
- - "~>"
|
179
207
|
- !ruby/object:Gem::Version
|
180
|
-
version: '13.
|
208
|
+
version: '13.2'
|
181
209
|
- !ruby/object:Gem::Dependency
|
182
210
|
name: rspec
|
183
211
|
requirement: !ruby/object:Gem::Requirement
|
184
212
|
requirements:
|
185
213
|
- - "~>"
|
186
214
|
- !ruby/object:Gem::Version
|
187
|
-
version: '3.
|
215
|
+
version: '3.13'
|
188
216
|
type: :development
|
189
217
|
prerelease: false
|
190
218
|
version_requirements: !ruby/object:Gem::Requirement
|
191
219
|
requirements:
|
192
220
|
- - "~>"
|
193
221
|
- !ruby/object:Gem::Version
|
194
|
-
version: '3.
|
222
|
+
version: '3.13'
|
195
223
|
description:
|
196
224
|
email:
|
197
225
|
- jasons@nulogy.com
|
@@ -216,6 +244,7 @@ files:
|
|
216
244
|
- lib/nucop/helpers/factory_bot_helper.rb
|
217
245
|
- lib/nucop/helpers/file_path_helper.rb
|
218
246
|
- lib/nucop/helpers/next_cop_for_promotion.rb
|
247
|
+
- lib/nucop/helpers/rubocop_gem_dependencies.rb
|
219
248
|
- lib/nucop/version.rb
|
220
249
|
homepage: https://rubygems.org/gems/nucop
|
221
250
|
licenses:
|
@@ -223,7 +252,6 @@ licenses:
|
|
223
252
|
metadata:
|
224
253
|
homepage_uri: https://github.com/nulogy/nucop
|
225
254
|
changelog_uri: https://github.com/nulogy/nucop/blob/master/CHANGELOG.md
|
226
|
-
source_code_uri: https://github.com/nulogy/nucop
|
227
255
|
bug_tracker_uri: https://github.com/nulogy/nucop/issues
|
228
256
|
rubygems_mfa_required: 'true'
|
229
257
|
post_install_message:
|
@@ -234,14 +262,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
262
|
requirements:
|
235
263
|
- - ">="
|
236
264
|
- !ruby/object:Gem::Version
|
237
|
-
version: '
|
265
|
+
version: '3.1'
|
238
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
267
|
requirements:
|
240
268
|
- - ">="
|
241
269
|
- !ruby/object:Gem::Version
|
242
270
|
version: '0'
|
243
271
|
requirements: []
|
244
|
-
rubygems_version: 3.
|
272
|
+
rubygems_version: 3.5.10
|
245
273
|
signing_key:
|
246
274
|
specification_version: 4
|
247
275
|
summary: Nulogy's implementation of RuboCop, including custom cops and additional
|