rubocop-g2 1.5.2 → 1.7.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 +9 -94
- data/.tool-versions +1 -1
- data/Gemfile.lock +16 -16
- data/config/ruby/default.yml +1 -1
- data/lib/rubocop/cop/g2/accessible_icons.rb +2 -0
- data/lib/rubocop/cop/g2/ban_sidekiq_worker.rb +9 -0
- data/lib/rubocop/cop/g2/safe_connection_handling.rb +18 -0
- data/lib/rubocop/g2/version.rb +1 -1
- data/lib/rubocop_g2.rb +1 -0
- data/rubocop-g2.gemspec +3 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b484fad7593fa6a699916c560ed8ec2b5d4926496168486b48ff6fff18492bb3
|
4
|
+
data.tar.gz: e4096d81c7896f473c6191e0f6f864f58d3a18e1872297ce2d32687400e78c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1483423826e3a387185ac626fc3b41a86531cddb705c5c9a02695c4534dc1353ae8504227ed5fc973fb3e1f1bec7068deda047a099cbd4df2d45709ebffd9ea3
|
7
|
+
data.tar.gz: dafd8ef06fa641161e1eb9a0073a65de9ab78046adc79f1f9afbadf420d69aafd613244ad4c3e277e0de1b1e24473e911a208fdf4bb4377c77daaecd1916f012
|
data/.rubocop.yml
CHANGED
@@ -1,102 +1,17 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- config/ruby/default.yml
|
3
|
+
- config/rspec/default.yml
|
4
|
+
|
1
5
|
require:
|
2
6
|
- rubocop-rspec
|
3
7
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Enabled: false
|
9
|
-
|
10
|
-
Layout/MultilineOperationIndentation:
|
11
|
-
Enabled: false
|
12
|
-
|
13
|
-
Layout/ClassStructure:
|
14
|
-
Enabled: true
|
15
|
-
|
16
|
-
Layout/MultilineMethodCallIndentation:
|
17
|
-
EnforcedStyle: indented_relative_to_receiver
|
18
|
-
|
19
|
-
Layout/EmptyLineAfterGuardClause:
|
20
|
-
Enabled: false
|
21
|
-
|
22
|
-
Layout/LineLength:
|
23
|
-
Max: 120
|
24
|
-
IgnoredPatterns:
|
25
|
-
- ^#
|
26
|
-
|
27
|
-
Lint/AssignmentInCondition:
|
28
|
-
Enabled: false
|
29
|
-
|
30
|
-
Lint/RaiseException:
|
31
|
-
Enabled: true
|
32
|
-
|
33
|
-
Lint/StructNewOverride:
|
34
|
-
Enabled: true
|
35
|
-
|
36
|
-
Metrics/AbcSize:
|
37
|
-
Max: 20
|
38
|
-
|
39
|
-
Metrics/BlockLength:
|
40
|
-
Enabled: false
|
41
|
-
|
42
|
-
Metrics/ClassLength:
|
43
|
-
Max: 500
|
44
|
-
|
45
|
-
Metrics/MethodLength:
|
46
|
-
Max: 15
|
47
|
-
|
48
|
-
Metrics/ParameterLists:
|
49
|
-
Max: 5
|
50
|
-
|
51
|
-
Style/AndOr:
|
52
|
-
Enabled: false
|
53
|
-
|
54
|
-
Style/ClassAndModuleChildren:
|
55
|
-
AutoCorrect: true
|
8
|
+
AllCops:
|
9
|
+
NewCops: enable
|
10
|
+
SuggestExtensions: false
|
11
|
+
TargetRubyVersion: 2.7
|
56
12
|
|
57
13
|
Style/Documentation:
|
58
14
|
Enabled: false
|
59
15
|
|
60
|
-
|
61
|
-
Enabled: false
|
62
|
-
|
63
|
-
Style/ExponentialNotation:
|
64
|
-
Enabled: false
|
65
|
-
|
66
|
-
Style/FormatStringToken:
|
67
|
-
EnforcedStyle: template
|
68
|
-
|
69
|
-
Style/FrozenStringLiteralComment:
|
70
|
-
Enabled: false
|
71
|
-
|
72
|
-
Style/HashEachMethods:
|
73
|
-
Enabled: true
|
74
|
-
|
75
|
-
Style/HashTransformKeys:
|
76
|
-
Enabled: false
|
77
|
-
|
78
|
-
Style/HashTransformValues:
|
79
|
-
Enabled: false
|
80
|
-
|
81
|
-
Style/Lambda:
|
82
|
-
Enabled: false
|
83
|
-
|
84
|
-
Style/LambdaCall:
|
85
|
-
Enabled: false
|
86
|
-
|
87
|
-
Style/NumericLiterals:
|
88
|
-
Enabled: false
|
89
|
-
|
90
|
-
Style/PercentLiteralDelimiters:
|
91
|
-
PreferredDelimiters:
|
92
|
-
default: ()
|
93
|
-
'%w': '()'
|
94
|
-
'%W': '()'
|
95
|
-
'%i': '()'
|
96
|
-
'%I': '()'
|
97
|
-
|
98
|
-
Style/SingleLineBlockParams:
|
99
|
-
Enabled: false
|
100
|
-
|
101
|
-
Style/SymbolProc:
|
16
|
+
RSpec/ExampleLength:
|
102
17
|
Enabled: false
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.
|
1
|
+
ruby 3.1.1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-g2 (1.
|
4
|
+
rubocop-g2 (1.7.0)
|
5
5
|
rubocop (>= 0.82)
|
6
6
|
rubocop-rails (>= 2.5)
|
7
7
|
rubocop-rspec (>= 1.39)
|
@@ -9,29 +9,29 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (7.0.
|
12
|
+
activesupport (7.0.2.4)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
16
16
|
tzinfo (~> 2.0)
|
17
17
|
ast (2.4.2)
|
18
18
|
coderay (1.1.2)
|
19
|
-
concurrent-ruby (1.1.
|
19
|
+
concurrent-ruby (1.1.10)
|
20
20
|
diff-lcs (1.3)
|
21
|
-
i18n (1.
|
21
|
+
i18n (1.10.0)
|
22
22
|
concurrent-ruby (~> 1.0)
|
23
23
|
method_source (0.9.2)
|
24
24
|
minitest (5.15.0)
|
25
|
-
parallel (1.
|
26
|
-
parser (3.1.
|
25
|
+
parallel (1.22.1)
|
26
|
+
parser (3.1.2.0)
|
27
27
|
ast (~> 2.4.1)
|
28
28
|
pry (0.12.2)
|
29
29
|
coderay (~> 1.1.0)
|
30
30
|
method_source (~> 0.9.0)
|
31
31
|
rack (2.2.3)
|
32
|
-
rainbow (3.
|
32
|
+
rainbow (3.1.1)
|
33
33
|
rake (12.3.3)
|
34
|
-
regexp_parser (2.
|
34
|
+
regexp_parser (2.3.1)
|
35
35
|
rexml (3.2.5)
|
36
36
|
rspec (3.8.0)
|
37
37
|
rspec-core (~> 3.8.0)
|
@@ -46,22 +46,22 @@ GEM
|
|
46
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
47
47
|
rspec-support (~> 3.8.0)
|
48
48
|
rspec-support (3.8.3)
|
49
|
-
rubocop (1.
|
49
|
+
rubocop (1.28.2)
|
50
50
|
parallel (~> 1.10)
|
51
|
-
parser (>= 3.
|
51
|
+
parser (>= 3.1.0.0)
|
52
52
|
rainbow (>= 2.2.2, < 4.0)
|
53
53
|
regexp_parser (>= 1.8, < 3.0)
|
54
54
|
rexml
|
55
|
-
rubocop-ast (>= 1.
|
55
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
56
56
|
ruby-progressbar (~> 1.7)
|
57
57
|
unicode-display_width (>= 1.4.0, < 3.0)
|
58
|
-
rubocop-ast (1.
|
59
|
-
parser (>= 3.
|
60
|
-
rubocop-rails (2.
|
58
|
+
rubocop-ast (1.17.0)
|
59
|
+
parser (>= 3.1.1.0)
|
60
|
+
rubocop-rails (2.14.2)
|
61
61
|
activesupport (>= 4.2.0)
|
62
62
|
rack (>= 1.1)
|
63
63
|
rubocop (>= 1.7.0, < 2.0)
|
64
|
-
rubocop-rspec (2.
|
64
|
+
rubocop-rspec (2.10.0)
|
65
65
|
rubocop (~> 1.19)
|
66
66
|
ruby-progressbar (1.11.0)
|
67
67
|
tzinfo (2.0.4)
|
@@ -79,4 +79,4 @@ DEPENDENCIES
|
|
79
79
|
rubocop-g2!
|
80
80
|
|
81
81
|
BUNDLED WITH
|
82
|
-
2.
|
82
|
+
2.3.12
|
data/config/ruby/default.yml
CHANGED
@@ -20,9 +20,11 @@ module RuboCop
|
|
20
20
|
args.find(&:hash_type?)&.children&.map(&:children) || []
|
21
21
|
end
|
22
22
|
|
23
|
+
# rubocop:disable Lint/BooleanSymbol
|
23
24
|
def args_include_decorative?(args)
|
24
25
|
args.include? [s(:sym, :decorative), s(:true)]
|
25
26
|
end
|
27
|
+
# rubocop:enable Lint/BooleanSymbol
|
26
28
|
|
27
29
|
def args_include_aria_label?(args)
|
28
30
|
args.any? { |arg| arg.first == s(:sym, :aria_label) && arg.last != s(:nil) }
|
@@ -2,7 +2,10 @@ module RuboCop
|
|
2
2
|
module Cop
|
3
3
|
module G2
|
4
4
|
class BanSidekiqWorker < RuboCop::Cop::Cop
|
5
|
+
extend AutoCorrector
|
6
|
+
|
5
7
|
MSG = 'Please use Sidekiq::Job instead of Sidekiq::Worker'.freeze
|
8
|
+
RESTRICT_ON_SEND = [:include].freeze
|
6
9
|
|
7
10
|
def_node_search :sidekiq_worker?, <<~PATTERN
|
8
11
|
(send nil? :include (const (const nil? :Sidekiq) :Worker))
|
@@ -12,6 +15,12 @@ module RuboCop
|
|
12
15
|
return unless sidekiq_worker?(node)
|
13
16
|
add_offense(node, location: :expression)
|
14
17
|
end
|
18
|
+
|
19
|
+
def autocorrect(node)
|
20
|
+
lambda do |corrector|
|
21
|
+
corrector.replace(node, node.source.gsub('Worker', 'Job'))
|
22
|
+
end
|
23
|
+
end
|
15
24
|
end
|
16
25
|
end
|
17
26
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RuboCop
|
2
|
+
module Cop
|
3
|
+
module G2
|
4
|
+
class SafeConnectionHandling < RuboCop::Cop::Cop
|
5
|
+
MSG = 'ActiveRecord::Base should only be used to create an ApplicationRecord subclass.'.freeze
|
6
|
+
|
7
|
+
def_node_matcher :safe_base_class?, <<~PATTERN
|
8
|
+
(send (const (const nil? :ActiveRecord) :Base) ...)
|
9
|
+
PATTERN
|
10
|
+
|
11
|
+
def on_send(node)
|
12
|
+
return unless safe_base_class?(node)
|
13
|
+
add_offense(node)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/rubocop/g2/version.rb
CHANGED
data/lib/rubocop_g2.rb
CHANGED
@@ -5,5 +5,6 @@ require_relative 'rubocop/cop/g2/ban_decorators'
|
|
5
5
|
require_relative 'rubocop/cop/g2/ban_sidekiq_worker'
|
6
6
|
require_relative 'rubocop/cop/g2/predicate_memoization'
|
7
7
|
require_relative 'rubocop/cop/g2/raw_connection_execute'
|
8
|
+
require_relative 'rubocop/cop/g2/safe_connection_handling'
|
8
9
|
require_relative 'rubocop/cop/g2/aggregates_model_boundary'
|
9
10
|
require_relative 'rubocop/cop/g2/accessible_icons'
|
data/rubocop-g2.gemspec
CHANGED
@@ -20,6 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
24
|
+
spec.required_ruby_version = '>= 2.7'
|
25
|
+
|
23
26
|
spec.add_dependency 'rubocop', '>= 0.82'
|
24
27
|
spec.add_dependency 'rubocop-rails', '>= 2.5'
|
25
28
|
spec.add_dependency 'rubocop-rspec', '>= 1.39'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-g2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Mannino
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -132,12 +132,14 @@ files:
|
|
132
132
|
- lib/rubocop/cop/g2/ban_sidekiq_worker.rb
|
133
133
|
- lib/rubocop/cop/g2/predicate_memoization.rb
|
134
134
|
- lib/rubocop/cop/g2/raw_connection_execute.rb
|
135
|
+
- lib/rubocop/cop/g2/safe_connection_handling.rb
|
135
136
|
- lib/rubocop/g2/version.rb
|
136
137
|
- lib/rubocop_g2.rb
|
137
138
|
- rubocop-g2.gemspec
|
138
139
|
homepage: https://g2.com
|
139
140
|
licenses: []
|
140
|
-
metadata:
|
141
|
+
metadata:
|
142
|
+
rubygems_mfa_required: 'true'
|
141
143
|
post_install_message:
|
142
144
|
rdoc_options: []
|
143
145
|
require_paths:
|
@@ -146,14 +148,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
148
|
requirements:
|
147
149
|
- - ">="
|
148
150
|
- !ruby/object:Gem::Version
|
149
|
-
version: '
|
151
|
+
version: '2.7'
|
150
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
153
|
requirements:
|
152
154
|
- - ">="
|
153
155
|
- !ruby/object:Gem::Version
|
154
156
|
version: '0'
|
155
157
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
158
|
+
rubygems_version: 3.3.7
|
157
159
|
signing_key:
|
158
160
|
specification_version: 4
|
159
161
|
summary: Custom cops for G2.
|