rubocop-g2 1.2.1 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +31 -33
- data/config/rspec/default.yml +6 -5
- data/lib/rubocop/cop/g2/accessible_icons.rb +33 -0
- data/lib/rubocop/g2/version.rb +1 -1
- data/lib/rubocop_g2.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87d1cc90b392bf3c4f97f19c5fad5ac16f88c9764c48a6825f7e18fb1d95aaef
|
4
|
+
data.tar.gz: f04a4f19bf1352496e19820ee81064343917287d61124ce4814700488be84b00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c7f62c8dadcc65123b6e733b2e94747b821f12d5eb2522631de24055733990817d0aa771e0157138cdb1a3aba0dc45a3add33593c7e52708e5d1e2fe77e8417
|
7
|
+
data.tar.gz: b50659a41db0c440e601e37eaa09b2fae0abc34147f2669e7e0fc141364492cf35a4a2dfbe734a1606199968ff9d848734ea4b39696e4432015f2666dbcc9c93
|
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.1)
|
5
5
|
rubocop (>= 0.82)
|
6
6
|
rubocop-rails (>= 2.5)
|
7
7
|
rubocop-rspec (>= 1.39)
|
@@ -9,22 +9,22 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.
|
12
|
+
activesupport (6.1.4.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
zeitwerk (~> 2.
|
18
|
-
ast (2.4.
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
|
+
ast (2.4.2)
|
19
19
|
coderay (1.1.2)
|
20
|
-
concurrent-ruby (1.1.
|
20
|
+
concurrent-ruby (1.1.9)
|
21
21
|
diff-lcs (1.3)
|
22
|
-
i18n (1.8.
|
22
|
+
i18n (1.8.10)
|
23
23
|
concurrent-ruby (~> 1.0)
|
24
24
|
method_source (0.9.2)
|
25
|
-
minitest (5.14.
|
26
|
-
parallel (1.
|
27
|
-
parser (
|
25
|
+
minitest (5.14.4)
|
26
|
+
parallel (1.21.0)
|
27
|
+
parser (3.0.2.0)
|
28
28
|
ast (~> 2.4.1)
|
29
29
|
pry (0.12.2)
|
30
30
|
coderay (~> 1.1.0)
|
@@ -32,8 +32,8 @@ GEM
|
|
32
32
|
rack (2.2.3)
|
33
33
|
rainbow (3.0.0)
|
34
34
|
rake (12.3.3)
|
35
|
-
regexp_parser (1.
|
36
|
-
rexml (3.2.
|
35
|
+
regexp_parser (2.1.1)
|
36
|
+
rexml (3.2.5)
|
37
37
|
rspec (3.8.0)
|
38
38
|
rspec-core (~> 3.8.0)
|
39
39
|
rspec-expectations (~> 3.8.0)
|
@@ -47,30 +47,28 @@ GEM
|
|
47
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
48
|
rspec-support (~> 3.8.0)
|
49
49
|
rspec-support (3.8.3)
|
50
|
-
rubocop (
|
50
|
+
rubocop (1.21.0)
|
51
51
|
parallel (~> 1.10)
|
52
|
-
parser (>=
|
52
|
+
parser (>= 3.0.0.0)
|
53
53
|
rainbow (>= 2.2.2, < 4.0)
|
54
|
-
regexp_parser (>= 1.8)
|
54
|
+
regexp_parser (>= 1.8, < 3.0)
|
55
55
|
rexml
|
56
|
-
rubocop-ast (>=
|
56
|
+
rubocop-ast (>= 1.9.1, < 2.0)
|
57
57
|
ruby-progressbar (~> 1.7)
|
58
|
-
unicode-display_width (>= 1.4.0, <
|
59
|
-
rubocop-ast (
|
60
|
-
parser (>=
|
61
|
-
rubocop-rails (2.
|
58
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
59
|
+
rubocop-ast (1.11.0)
|
60
|
+
parser (>= 3.0.1.1)
|
61
|
+
rubocop-rails (2.12.2)
|
62
62
|
activesupport (>= 4.2.0)
|
63
63
|
rack (>= 1.1)
|
64
|
-
rubocop (>=
|
65
|
-
rubocop-rspec (
|
66
|
-
rubocop (~>
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
unicode-display_width (1.7.0)
|
73
|
-
zeitwerk (2.4.0)
|
64
|
+
rubocop (>= 1.7.0, < 2.0)
|
65
|
+
rubocop-rspec (2.5.0)
|
66
|
+
rubocop (~> 1.19)
|
67
|
+
ruby-progressbar (1.11.0)
|
68
|
+
tzinfo (2.0.4)
|
69
|
+
concurrent-ruby (~> 1.0)
|
70
|
+
unicode-display_width (2.1.0)
|
71
|
+
zeitwerk (2.4.2)
|
74
72
|
|
75
73
|
PLATFORMS
|
76
74
|
ruby
|
@@ -83,4 +81,4 @@ DEPENDENCIES
|
|
83
81
|
rubocop-g2!
|
84
82
|
|
85
83
|
BUNDLED WITH
|
86
|
-
2.
|
84
|
+
2.2.23
|
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
|
data/lib/rubocop/g2/version.rb
CHANGED
data/lib/rubocop_g2.rb
CHANGED
@@ -5,3 +5,4 @@ require_relative 'rubocop/cop/g2/ban_decorators'
|
|
5
5
|
require_relative 'rubocop/cop/g2/predicate_memoization'
|
6
6
|
require_relative 'rubocop/cop/g2/raw_connection_execute'
|
7
7
|
require_relative 'rubocop/cop/g2/aggregates_model_boundary'
|
8
|
+
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Mannino
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -126,6 +126,7 @@ 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
|
131
132
|
- lib/rubocop/cop/g2/predicate_memoization.rb
|