nxt_cop 2.3.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +37 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +55 -33
- data/default.yml +0 -4
- data/lib/nxt_cop/version.rb +1 -1
- data/nxt_cop.gemspec +7 -2
- metadata +79 -8
- data/custom_cops/nxt_core/rails/missing_logger_include.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d36d052009c7de1ca3318d89019cd42f7db459c9ee4b2c0dd88f2e63adc37a83
|
4
|
+
data.tar.gz: 5c8b68f2cf5db256d431f1e7a37702417401b82eb017af97a71f73c0f515fc2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83bf1c4ce35ca15ea3211674015ca930797974855394b65fb3fbdd059399aae5542cf34be808d587df99a981ee2bc28fecfac7c2645bb244662bad3e35428fba
|
7
|
+
data.tar.gz: cf81b2893d0dfd9d8df6b4d9ff624fe16bfe70a546849fa5a0bb8a84b73f555ced914022ed452dc0e9f9ada71fcf4a9069c717a9dc3169b7d5b4241097472400
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# See https://circleci.com/docs/2.0/language-ruby/ for more details
|
2
|
+
|
3
|
+
version: 2.1
|
4
|
+
|
5
|
+
orbs:
|
6
|
+
ruby: circleci/ruby@2.0.1
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
checks:
|
10
|
+
parallelism: 1
|
11
|
+
resource_class: small
|
12
|
+
docker:
|
13
|
+
- image: cimg/ruby:3.3.2
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
- ruby/install-deps:
|
17
|
+
key: gems-v1
|
18
|
+
include-branch-in-cache-key: false
|
19
|
+
# - ruby/rubocop-check
|
20
|
+
- run:
|
21
|
+
name: RSpec Tests
|
22
|
+
command: |-
|
23
|
+
bundle exec rspec --format RspecJunitFormatter \
|
24
|
+
--out /tmp/test-results/rspec/results.xml --format progress
|
25
|
+
# actually not necessary for test results to be collected, but these files
|
26
|
+
# won't show up in the web UI otherwise
|
27
|
+
- store_artifacts:
|
28
|
+
path: /tmp/rspec/
|
29
|
+
destination: rspec
|
30
|
+
- store_test_results:
|
31
|
+
path: /tmp/rspec/
|
32
|
+
|
33
|
+
workflows:
|
34
|
+
version: 2
|
35
|
+
checks:
|
36
|
+
jobs:
|
37
|
+
- checks
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.2
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.3.
|
1
|
+
ruby 3.3.2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# v2.5.0 2024-06-11
|
2
|
+
## What's Changed
|
3
|
+
- Relaxes the rubocop version to not pin the patch
|
4
|
+
- Updates the ruby version to 3.3.2
|
5
|
+
- Updates dependencies
|
6
|
+
|
7
|
+
# v2.4.0 2024-02-19
|
8
|
+
## What's Changed
|
9
|
+
- Add tests for custom cops
|
10
|
+
- Removed `Rails/MissingLoggerInclude` due to maintenance burden
|
11
|
+
|
1
12
|
# v2.3.0 2024-02-09
|
2
13
|
## What's Changed
|
3
14
|
- Tree shake the config (no rules change)
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nxt_cop (2.
|
5
|
-
rubocop (~> 1.60
|
4
|
+
nxt_cop (2.5.0)
|
5
|
+
rubocop (~> 1.60)
|
6
|
+
rubocop-capybara (~> 2.21)
|
7
|
+
rubocop-factory_bot (~> 2.26)
|
6
8
|
rubocop-rails (~> 2.8)
|
7
|
-
rubocop-rspec (~>
|
9
|
+
rubocop-rspec (~> 3.0)
|
10
|
+
rubocop-rspec_rails (~> 2.30)
|
8
11
|
|
9
12
|
GEM
|
10
13
|
remote: https://rubygems.org/
|
11
14
|
specs:
|
12
|
-
activesupport (7.1.3)
|
15
|
+
activesupport (7.1.3.4)
|
13
16
|
base64
|
14
17
|
bigdecimal
|
15
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -21,28 +24,44 @@ GEM
|
|
21
24
|
tzinfo (~> 2.0)
|
22
25
|
ast (2.4.2)
|
23
26
|
base64 (0.2.0)
|
24
|
-
bigdecimal (3.1.
|
25
|
-
concurrent-ruby (1.
|
27
|
+
bigdecimal (3.1.8)
|
28
|
+
concurrent-ruby (1.3.3)
|
26
29
|
connection_pool (2.4.1)
|
27
|
-
|
28
|
-
|
29
|
-
i18n (1.14.
|
30
|
+
diff-lcs (1.5.1)
|
31
|
+
drb (2.2.1)
|
32
|
+
i18n (1.14.5)
|
30
33
|
concurrent-ruby (~> 1.0)
|
31
|
-
json (2.7.
|
34
|
+
json (2.7.2)
|
32
35
|
language_server-protocol (3.17.0.3)
|
33
|
-
minitest (5.
|
36
|
+
minitest (5.23.1)
|
34
37
|
mutex_m (0.2.0)
|
35
|
-
parallel (1.
|
36
|
-
parser (3.3.0
|
38
|
+
parallel (1.25.1)
|
39
|
+
parser (3.3.2.0)
|
37
40
|
ast (~> 2.4.1)
|
38
41
|
racc
|
39
|
-
racc (1.
|
40
|
-
rack (3.0
|
42
|
+
racc (1.8.0)
|
43
|
+
rack (3.1.0)
|
41
44
|
rainbow (3.1.1)
|
42
|
-
rake (13.1
|
43
|
-
regexp_parser (2.9.
|
44
|
-
rexml (3.
|
45
|
-
|
45
|
+
rake (13.2.1)
|
46
|
+
regexp_parser (2.9.2)
|
47
|
+
rexml (3.3.0)
|
48
|
+
strscan
|
49
|
+
rspec (3.13.0)
|
50
|
+
rspec-core (~> 3.13.0)
|
51
|
+
rspec-expectations (~> 3.13.0)
|
52
|
+
rspec-mocks (~> 3.13.0)
|
53
|
+
rspec-core (3.13.0)
|
54
|
+
rspec-support (~> 3.13.0)
|
55
|
+
rspec-expectations (3.13.0)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.13.0)
|
58
|
+
rspec-mocks (3.13.1)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.13.0)
|
61
|
+
rspec-support (3.13.1)
|
62
|
+
rspec_junit_formatter (0.6.0)
|
63
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
64
|
+
rubocop (1.64.1)
|
46
65
|
json (~> 2.3)
|
47
66
|
language_server-protocol (>= 3.17.0)
|
48
67
|
parallel (~> 1.10)
|
@@ -50,26 +69,27 @@ GEM
|
|
50
69
|
rainbow (>= 2.2.2, < 4.0)
|
51
70
|
regexp_parser (>= 1.8, < 3.0)
|
52
71
|
rexml (>= 3.2.5, < 4.0)
|
53
|
-
rubocop-ast (>= 1.
|
72
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
54
73
|
ruby-progressbar (~> 1.7)
|
55
74
|
unicode-display_width (>= 2.4.0, < 3.0)
|
56
|
-
rubocop-ast (1.
|
57
|
-
parser (>= 3.
|
58
|
-
rubocop-capybara (2.
|
75
|
+
rubocop-ast (1.31.3)
|
76
|
+
parser (>= 3.3.1.0)
|
77
|
+
rubocop-capybara (2.21.0)
|
59
78
|
rubocop (~> 1.41)
|
60
|
-
rubocop-factory_bot (2.
|
61
|
-
rubocop (~> 1.
|
62
|
-
rubocop-rails (2.
|
79
|
+
rubocop-factory_bot (2.26.1)
|
80
|
+
rubocop (~> 1.61)
|
81
|
+
rubocop-rails (2.25.0)
|
63
82
|
activesupport (>= 4.2.0)
|
64
83
|
rack (>= 1.1)
|
65
84
|
rubocop (>= 1.33.0, < 2.0)
|
66
|
-
rubocop-ast (>= 1.
|
67
|
-
rubocop-rspec (
|
68
|
-
rubocop (~> 1.
|
69
|
-
|
70
|
-
rubocop
|
85
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
86
|
+
rubocop-rspec (3.0.1)
|
87
|
+
rubocop (~> 1.61)
|
88
|
+
rubocop-rspec_rails (2.30.0)
|
89
|
+
rubocop (~> 1.61)
|
90
|
+
rubocop-rspec (~> 3, >= 3.0.1)
|
71
91
|
ruby-progressbar (1.13.0)
|
72
|
-
|
92
|
+
strscan (3.1.0)
|
73
93
|
tzinfo (2.0.6)
|
74
94
|
concurrent-ruby (~> 1.0)
|
75
95
|
unicode-display_width (2.5.0)
|
@@ -81,6 +101,8 @@ DEPENDENCIES
|
|
81
101
|
bundler (~> 2.1)
|
82
102
|
nxt_cop!
|
83
103
|
rake (~> 13.0)
|
104
|
+
rspec
|
105
|
+
rspec_junit_formatter
|
84
106
|
|
85
107
|
BUNDLED WITH
|
86
|
-
2.
|
108
|
+
2.5.5
|
data/default.yml
CHANGED
@@ -3,7 +3,6 @@ require:
|
|
3
3
|
- rubocop-rails
|
4
4
|
- rubocop-rspec
|
5
5
|
- ./custom_cops/nxt_core/rails/use_of_rails_logger.rb
|
6
|
-
- ./custom_cops/nxt_core/rails/missing_logger_include.rb
|
7
6
|
|
8
7
|
inherit_mode:
|
9
8
|
merge:
|
@@ -12,9 +11,6 @@ inherit_mode:
|
|
12
11
|
|
13
12
|
Rails/UseOfRailsLogger:
|
14
13
|
Description: "Custom Getsafe cop to ensure the correct logger is used"
|
15
|
-
Rails/MissingLoggerInclude:
|
16
|
-
Description: "Custom Getsafe cop to find missing `include` statements when using our custom logger"
|
17
|
-
SafeAutoCorrect: false
|
18
14
|
|
19
15
|
AllCops:
|
20
16
|
Exclude:
|
data/lib/nxt_cop/version.rb
CHANGED
data/nxt_cop.gemspec
CHANGED
@@ -33,9 +33,14 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.required_ruby_version = '>= 3.2'
|
35
35
|
|
36
|
-
spec.add_dependency 'rubocop', '~> 1.60
|
36
|
+
spec.add_dependency 'rubocop', '~> 1.60'
|
37
|
+
spec.add_dependency 'rubocop-capybara', '~> 2.21'
|
38
|
+
spec.add_dependency 'rubocop-factory_bot', '~> 2.26'
|
37
39
|
spec.add_dependency 'rubocop-rails', '~> 2.8'
|
38
|
-
spec.add_dependency 'rubocop-rspec', '~>
|
40
|
+
spec.add_dependency 'rubocop-rspec', '~> 3.0'
|
41
|
+
spec.add_dependency 'rubocop-rspec_rails', '~> 2.30'
|
39
42
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
40
43
|
spec.add_development_dependency 'rake', '~> 13.0'
|
44
|
+
spec.add_development_dependency 'rspec'
|
45
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
41
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nxt_cop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Livingstone
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,14 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.60
|
19
|
+
version: '1.60'
|
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: 1.60
|
26
|
+
version: '1.60'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-capybara
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.21'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.21'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-factory_bot
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.26'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.26'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rubocop-rails
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +72,28 @@ dependencies:
|
|
44
72
|
requirements:
|
45
73
|
- - "~>"
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
75
|
+
version: '3.0'
|
48
76
|
type: :runtime
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec_rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.30'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.30'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: bundler
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,13 +122,43 @@ dependencies:
|
|
80
122
|
- - "~>"
|
81
123
|
- !ruby/object:Gem::Version
|
82
124
|
version: '13.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rspec_junit_formatter
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
83
153
|
description:
|
84
154
|
email:
|
85
155
|
executables: []
|
86
156
|
extensions: []
|
87
157
|
extra_rdoc_files: []
|
88
158
|
files:
|
159
|
+
- ".circleci/config.yml"
|
89
160
|
- ".gitignore"
|
161
|
+
- ".rspec"
|
90
162
|
- ".rubocop.yml"
|
91
163
|
- ".ruby-version"
|
92
164
|
- ".tool-versions"
|
@@ -100,7 +172,6 @@ files:
|
|
100
172
|
- bin/guard
|
101
173
|
- bin/rspec
|
102
174
|
- bin/setup
|
103
|
-
- custom_cops/nxt_core/rails/missing_logger_include.rb
|
104
175
|
- custom_cops/nxt_core/rails/use_of_rails_logger.rb
|
105
176
|
- default.yml
|
106
177
|
- lib/nxt_cop/version.rb
|
@@ -128,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
199
|
- !ruby/object:Gem::Version
|
129
200
|
version: '0'
|
130
201
|
requirements: []
|
131
|
-
rubygems_version: 3.5.
|
202
|
+
rubygems_version: 3.5.9
|
132
203
|
signing_key:
|
133
204
|
specification_version: 4
|
134
205
|
summary: Getsafe shared Rubocop.
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CustomCops
|
4
|
-
module NxtCore
|
5
|
-
module Rails
|
6
|
-
# The NxtCore logger requires an include in most cases. Ensures it is present.
|
7
|
-
#
|
8
|
-
# @safety
|
9
|
-
# This cop's autocorrection is unsafe because
|
10
|
-
# `logger` may refer to an instance variable or other method of the class.
|
11
|
-
class MissingLoggerInclude < RuboCop::Cop::Base
|
12
|
-
extend RuboCop::Cop::AutoCorrector
|
13
|
-
|
14
|
-
RESTRICT_ON_SEND = [:logger].freeze
|
15
|
-
|
16
|
-
MSG = 'Missing `include Nxt::Loggable` for a class which uses the logger.'
|
17
|
-
|
18
|
-
# NodePattern docs: https://github.com/rubocop/rubocop-ast/blob/master/docs/modules/ROOT/pages/node_pattern.adoc
|
19
|
-
def_node_matcher :includes_nxt_loggable?, <<~PATTERN
|
20
|
-
(begin <(send nil? :include (const (const nil? :Nxt) :Loggable)) ...>)
|
21
|
-
PATTERN
|
22
|
-
|
23
|
-
def on_send(node)
|
24
|
-
return unless node.receiver.nil?
|
25
|
-
|
26
|
-
class_node = node.ancestors.find(&:class_type?)
|
27
|
-
return unless class_node
|
28
|
-
|
29
|
-
class_definition_node = class_node.each_child_node(:begin).first
|
30
|
-
return if includes_nxt_loggable?(class_definition_node)
|
31
|
-
|
32
|
-
add_offense(class_node, message: MSG) do |corrector|
|
33
|
-
corrector.insert_before(class_definition_node.child_nodes.first, "include Nxt::Loggable\n")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|