rubocop-g2 1.3.0 → 1.5.2
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/.tool-versions +1 -1
- data/Gemfile.lock +29 -33
- data/config/rspec/default.yml +6 -4
- data/lib/rubocop/cop/g2/accessible_icons.rb +33 -0
- data/lib/rubocop/cop/g2/ban_sidekiq_worker.rb +18 -0
- data/lib/rubocop/g2/version.rb +1 -1
- data/lib/rubocop_g2.rb +2 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 982a0b5149f0b032cbc1507f6c73fbbefe834747ac7ccf539b5a63dcaa942a6c
|
4
|
+
data.tar.gz: 88056a2738f25250eba732b682b769168289ca3d09d931b778cdb559a96a3dfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d0f849b6d7db262ccacaf432bb69a957cca880479b48bb9c25989fda6b6c9f31371450d0c050ad9a93a06ca26bd13279b2a7da0504202180b848e3ece130eb7
|
7
|
+
data.tar.gz: 3a578661ba3403a7d011f2e7450918b9f35f16896d43fc46ed6b6d3c05dfd81ca7b8c2dd689d879e26276049f4e9b40a4bed7809ece78acb97bb9e161a6e8fcf
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby
|
1
|
+
ruby 3.0.3
|
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.5.2)
|
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 (
|
12
|
+
activesupport (7.0.0)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
|
18
|
-
ast (2.4.1)
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
ast (2.4.2)
|
19
18
|
coderay (1.1.2)
|
20
|
-
concurrent-ruby (1.1.
|
19
|
+
concurrent-ruby (1.1.9)
|
21
20
|
diff-lcs (1.3)
|
22
|
-
i18n (1.8.
|
21
|
+
i18n (1.8.11)
|
23
22
|
concurrent-ruby (~> 1.0)
|
24
23
|
method_source (0.9.2)
|
25
|
-
minitest (5.
|
26
|
-
parallel (1.
|
27
|
-
parser (
|
24
|
+
minitest (5.15.0)
|
25
|
+
parallel (1.21.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,8 +31,8 @@ GEM
|
|
32
31
|
rack (2.2.3)
|
33
32
|
rainbow (3.0.0)
|
34
33
|
rake (12.3.3)
|
35
|
-
regexp_parser (
|
36
|
-
rexml (3.2.
|
34
|
+
regexp_parser (2.2.0)
|
35
|
+
rexml (3.2.5)
|
37
36
|
rspec (3.8.0)
|
38
37
|
rspec-core (~> 3.8.0)
|
39
38
|
rspec-expectations (~> 3.8.0)
|
@@ -47,30 +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.
|
49
|
+
rubocop (1.24.1)
|
51
50
|
parallel (~> 1.10)
|
52
|
-
parser (>=
|
51
|
+
parser (>= 3.0.0.0)
|
53
52
|
rainbow (>= 2.2.2, < 4.0)
|
54
|
-
regexp_parser (>= 1.8)
|
53
|
+
regexp_parser (>= 1.8, < 3.0)
|
55
54
|
rexml
|
56
|
-
rubocop-ast (>= 1.
|
55
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
57
56
|
ruby-progressbar (~> 1.7)
|
58
|
-
unicode-display_width (>= 1.4.0, <
|
59
|
-
rubocop-ast (1.
|
60
|
-
parser (>=
|
61
|
-
rubocop-rails (2.
|
57
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
58
|
+
rubocop-ast (1.15.1)
|
59
|
+
parser (>= 3.0.1.1)
|
60
|
+
rubocop-rails (2.13.0)
|
62
61
|
activesupport (>= 4.2.0)
|
63
62
|
rack (>= 1.1)
|
64
|
-
rubocop (>=
|
65
|
-
rubocop-rspec (2.
|
66
|
-
rubocop (~> 1.
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
thread_safe (~> 0.1)
|
72
|
-
unicode-display_width (1.7.0)
|
73
|
-
zeitwerk (2.4.1)
|
63
|
+
rubocop (>= 1.7.0, < 2.0)
|
64
|
+
rubocop-rspec (2.7.0)
|
65
|
+
rubocop (~> 1.19)
|
66
|
+
ruby-progressbar (1.11.0)
|
67
|
+
tzinfo (2.0.4)
|
68
|
+
concurrent-ruby (~> 1.0)
|
69
|
+
unicode-display_width (2.1.0)
|
74
70
|
|
75
71
|
PLATFORMS
|
76
72
|
ruby
|
@@ -83,4 +79,4 @@ DEPENDENCIES
|
|
83
79
|
rubocop-g2!
|
84
80
|
|
85
81
|
BUNDLED WITH
|
86
|
-
2.
|
82
|
+
2.2.32
|
data/config/rspec/default.yml
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
module RuboCop
|
2
|
+
module Cop
|
3
|
+
module G2
|
4
|
+
class AccessibleIcons < RuboCop::Cop::Cop
|
5
|
+
MSG = 'Make SVGs accessible by either marking them as decorative (`decorative: true`) '\
|
6
|
+
"or adding a label (`aria_label: t('path.to.description')`)".freeze
|
7
|
+
|
8
|
+
RESTRICT_ON_SEND = %i(inline_icon).freeze
|
9
|
+
|
10
|
+
def on_send(node)
|
11
|
+
keyword_args = array_of_kwargs node.arguments
|
12
|
+
return if args_include_decorative?(keyword_args) ^ args_include_aria_label?(keyword_args)
|
13
|
+
|
14
|
+
add_offense node
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def array_of_kwargs(args)
|
20
|
+
args.find(&:hash_type?)&.children&.map(&:children) || []
|
21
|
+
end
|
22
|
+
|
23
|
+
def args_include_decorative?(args)
|
24
|
+
args.include? [s(:sym, :decorative), s(:true)]
|
25
|
+
end
|
26
|
+
|
27
|
+
def args_include_aria_label?(args)
|
28
|
+
args.any? { |arg| arg.first == s(:sym, :aria_label) && arg.last != s(:nil) }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RuboCop
|
2
|
+
module Cop
|
3
|
+
module G2
|
4
|
+
class BanSidekiqWorker < RuboCop::Cop::Cop
|
5
|
+
MSG = 'Please use Sidekiq::Job instead of Sidekiq::Worker'.freeze
|
6
|
+
|
7
|
+
def_node_search :sidekiq_worker?, <<~PATTERN
|
8
|
+
(send nil? :include (const (const nil? :Sidekiq) :Worker))
|
9
|
+
PATTERN
|
10
|
+
|
11
|
+
def on_send(node)
|
12
|
+
return unless sidekiq_worker?(node)
|
13
|
+
add_offense(node, location: :expression)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/rubocop/g2/version.rb
CHANGED
data/lib/rubocop_g2.rb
CHANGED
@@ -2,6 +2,8 @@ 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'
|
7
8
|
require_relative 'rubocop/cop/g2/aggregates_model_boundary'
|
9
|
+
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.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Mannino
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '3.7'
|
111
|
-
description:
|
111
|
+
description:
|
112
112
|
email:
|
113
113
|
- pmannino@g2.com
|
114
114
|
executables: []
|
@@ -126,8 +126,10 @@ files:
|
|
126
126
|
- config/rspec/default.yml
|
127
127
|
- config/ruby/default.yml
|
128
128
|
- lib/rubocop-g2.rb
|
129
|
+
- lib/rubocop/cop/g2/accessible_icons.rb
|
129
130
|
- lib/rubocop/cop/g2/aggregates_model_boundary.rb
|
130
131
|
- lib/rubocop/cop/g2/ban_decorators.rb
|
132
|
+
- lib/rubocop/cop/g2/ban_sidekiq_worker.rb
|
131
133
|
- lib/rubocop/cop/g2/predicate_memoization.rb
|
132
134
|
- lib/rubocop/cop/g2/raw_connection_execute.rb
|
133
135
|
- lib/rubocop/g2/version.rb
|
@@ -136,7 +138,7 @@ files:
|
|
136
138
|
homepage: https://g2.com
|
137
139
|
licenses: []
|
138
140
|
metadata: {}
|
139
|
-
post_install_message:
|
141
|
+
post_install_message:
|
140
142
|
rdoc_options: []
|
141
143
|
require_paths:
|
142
144
|
- lib
|
@@ -151,8 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
153
|
- !ruby/object:Gem::Version
|
152
154
|
version: '0'
|
153
155
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
155
|
-
signing_key:
|
156
|
+
rubygems_version: 3.2.32
|
157
|
+
signing_key:
|
156
158
|
specification_version: 4
|
157
159
|
summary: Custom cops for G2.
|
158
160
|
test_files: []
|