rubocop-g2 1.5.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87d1cc90b392bf3c4f97f19c5fad5ac16f88c9764c48a6825f7e18fb1d95aaef
4
- data.tar.gz: f04a4f19bf1352496e19820ee81064343917287d61124ce4814700488be84b00
3
+ metadata.gz: 78336eed3c07bfeec4e0b69c5aff3c25afe16a829a7189ed845d324ffbf1e000
4
+ data.tar.gz: ec8ba26224f063994a158ef7924c124e08146bebc79908f83499e3e20b07c14f
5
5
  SHA512:
6
- metadata.gz: 4c7f62c8dadcc65123b6e733b2e94747b821f12d5eb2522631de24055733990817d0aa771e0157138cdb1a3aba0dc45a3add33593c7e52708e5d1e2fe77e8417
7
- data.tar.gz: b50659a41db0c440e601e37eaa09b2fae0abc34147f2669e7e0fc141364492cf35a4a2dfbe734a1606199968ff9d848734ea4b39696e4432015f2666dbcc9c93
6
+ metadata.gz: 341ea0af56943e1029e7909a382f1da8ff2a332ca8c7d62a39cca6c631aa73c0ce5de58a85c7f5e0f7ac26e9964c4c02f24fa53249b1c7def23f71c3525cc54b
7
+ data.tar.gz: 3ec4fe034ba044d66d9796cefedc31dbad4eadca4476ab4f2cf819dac6edcab4f8c78470d2b7300669fe5aff84de5c71a81dcfbb9718e17ac285f9131665e3b4
data/.rubocop.yml CHANGED
@@ -100,3 +100,6 @@ Style/SingleLineBlockParams:
100
100
 
101
101
  Style/SymbolProc:
102
102
  Enabled: false
103
+
104
+ RSpec/ExampleLength:
105
+ Enabled: false
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.7.2
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.5.1)
4
+ rubocop-g2 (1.5.3)
5
5
  rubocop (>= 0.82)
6
6
  rubocop-rails (>= 2.5)
7
7
  rubocop-rspec (>= 1.39)
@@ -9,22 +9,21 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.1.4.1)
12
+ activesupport (7.0.1)
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
- zeitwerk (~> 2.3)
18
17
  ast (2.4.2)
19
18
  coderay (1.1.2)
20
19
  concurrent-ruby (1.1.9)
21
20
  diff-lcs (1.3)
22
- i18n (1.8.10)
21
+ i18n (1.8.11)
23
22
  concurrent-ruby (~> 1.0)
24
23
  method_source (0.9.2)
25
- minitest (5.14.4)
24
+ minitest (5.15.0)
26
25
  parallel (1.21.0)
27
- parser (3.0.2.0)
26
+ parser (3.1.0.0)
28
27
  ast (~> 2.4.1)
29
28
  pry (0.12.2)
30
29
  coderay (~> 1.1.0)
@@ -32,7 +31,7 @@ GEM
32
31
  rack (2.2.3)
33
32
  rainbow (3.0.0)
34
33
  rake (12.3.3)
35
- regexp_parser (2.1.1)
34
+ regexp_parser (2.2.0)
36
35
  rexml (3.2.5)
37
36
  rspec (3.8.0)
38
37
  rspec-core (~> 3.8.0)
@@ -47,28 +46,27 @@ GEM
47
46
  diff-lcs (>= 1.2.0, < 2.0)
48
47
  rspec-support (~> 3.8.0)
49
48
  rspec-support (3.8.3)
50
- rubocop (1.21.0)
49
+ rubocop (1.24.1)
51
50
  parallel (~> 1.10)
52
51
  parser (>= 3.0.0.0)
53
52
  rainbow (>= 2.2.2, < 4.0)
54
53
  regexp_parser (>= 1.8, < 3.0)
55
54
  rexml
56
- rubocop-ast (>= 1.9.1, < 2.0)
55
+ rubocop-ast (>= 1.15.1, < 2.0)
57
56
  ruby-progressbar (~> 1.7)
58
57
  unicode-display_width (>= 1.4.0, < 3.0)
59
- rubocop-ast (1.11.0)
58
+ rubocop-ast (1.15.1)
60
59
  parser (>= 3.0.1.1)
61
- rubocop-rails (2.12.2)
60
+ rubocop-rails (2.13.0)
62
61
  activesupport (>= 4.2.0)
63
62
  rack (>= 1.1)
64
63
  rubocop (>= 1.7.0, < 2.0)
65
- rubocop-rspec (2.5.0)
64
+ rubocop-rspec (2.7.0)
66
65
  rubocop (~> 1.19)
67
66
  ruby-progressbar (1.11.0)
68
67
  tzinfo (2.0.4)
69
68
  concurrent-ruby (~> 1.0)
70
69
  unicode-display_width (2.1.0)
71
- zeitwerk (2.4.2)
72
70
 
73
71
  PLATFORMS
74
72
  ruby
@@ -81,4 +79,4 @@ DEPENDENCIES
81
79
  rubocop-g2!
82
80
 
83
81
  BUNDLED WITH
84
- 2.2.23
82
+ 2.3.10
@@ -0,0 +1,27 @@
1
+ module RuboCop
2
+ module Cop
3
+ module G2
4
+ class BanSidekiqWorker < RuboCop::Cop::Cop
5
+ extend AutoCorrector
6
+
7
+ MSG = 'Please use Sidekiq::Job instead of Sidekiq::Worker'.freeze
8
+ RESTRICT_ON_SEND = [:include].freeze
9
+
10
+ def_node_search :sidekiq_worker?, <<~PATTERN
11
+ (send nil? :include (const (const nil? :Sidekiq) :Worker))
12
+ PATTERN
13
+
14
+ def on_send(node)
15
+ return unless sidekiq_worker?(node)
16
+ add_offense(node, location: :expression)
17
+ end
18
+
19
+ def autocorrect(node)
20
+ lambda do |corrector|
21
+ corrector.replace(node, node.source.gsub('Worker', 'Job'))
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ 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
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module G2
3
- VERSION = '1.5.1'.freeze
3
+ VERSION = '1.6.0'.freeze
4
4
  end
5
5
  end
data/lib/rubocop_g2.rb CHANGED
@@ -2,7 +2,9 @@ require 'rubocop'
2
2
 
3
3
  require_relative 'rubocop/g2/version'
4
4
  require_relative 'rubocop/cop/g2/ban_decorators'
5
+ require_relative 'rubocop/cop/g2/ban_sidekiq_worker'
5
6
  require_relative 'rubocop/cop/g2/predicate_memoization'
6
7
  require_relative 'rubocop/cop/g2/raw_connection_execute'
8
+ require_relative 'rubocop/cop/g2/safe_connection_handling'
7
9
  require_relative 'rubocop/cop/g2/aggregates_model_boundary'
8
10
  require_relative 'rubocop/cop/g2/accessible_icons'
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.5.1
4
+ version: 1.6.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: 2021-09-26 00:00:00.000000000 Z
11
+ date: 2022-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -129,8 +129,10 @@ files:
129
129
  - lib/rubocop/cop/g2/accessible_icons.rb
130
130
  - lib/rubocop/cop/g2/aggregates_model_boundary.rb
131
131
  - lib/rubocop/cop/g2/ban_decorators.rb
132
+ - lib/rubocop/cop/g2/ban_sidekiq_worker.rb
132
133
  - lib/rubocop/cop/g2/predicate_memoization.rb
133
134
  - lib/rubocop/cop/g2/raw_connection_execute.rb
135
+ - lib/rubocop/cop/g2/safe_connection_handling.rb
134
136
  - lib/rubocop/g2/version.rb
135
137
  - lib/rubocop_g2.rb
136
138
  - rubocop-g2.gemspec
@@ -152,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
154
  - !ruby/object:Gem::Version
153
155
  version: '0'
154
156
  requirements: []
155
- rubygems_version: 3.1.4
157
+ rubygems_version: 3.3.7
156
158
  signing_key:
157
159
  specification_version: 4
158
160
  summary: Custom cops for G2.