rubocop-g2 1.1.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -1
- data/Gemfile.lock +37 -34
- data/config/rspec/default.yml +6 -4
- data/config/ruby/default.yml +3 -0
- 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
- data/rubocop-g2.gemspec +4 -4
- metadata +22 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1db6fe3ca651f25244c105904e3ade2aa59d66e03ad9af7c723346bebc8ec3ec
|
4
|
+
data.tar.gz: f59831bc819a38dd8732de5784d217bc141aff96f7648634a31bf9f298021232
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 922b155abca3d15cde8681c1376bc09f62623295196b3928a63377e04614332267782b8ff5b9a3364b1eb8a1a2100d5b25cd34f04bbe71ebf29bd3ae37952fa8
|
7
|
+
data.tar.gz: a328f94e4da34449f42a5c6fabe800f87e0e905b11c5523f33874af1b2aa5b5e71fa692be8b7be153b4d5bac6c827b138275c973dd62d7f5f0a740b688fb04ef
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.
|
1
|
+
ruby 2.7.2
|
data/Gemfile.lock
CHANGED
@@ -1,39 +1,39 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-g2 (1.
|
5
|
-
rubocop (
|
6
|
-
rubocop-rails (
|
7
|
-
rubocop-rspec (
|
4
|
+
rubocop-g2 (1.4.0)
|
5
|
+
rubocop (>= 0.82)
|
6
|
+
rubocop-rails (>= 2.5)
|
7
|
+
rubocop-rspec (>= 1.39)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.
|
12
|
+
activesupport (6.1.4)
|
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
|
-
jaro_winkler (1.5.4)
|
25
24
|
method_source (0.9.2)
|
26
|
-
minitest (5.14.
|
27
|
-
parallel (1.
|
28
|
-
parser (
|
29
|
-
ast (~> 2.4.
|
25
|
+
minitest (5.14.4)
|
26
|
+
parallel (1.20.0)
|
27
|
+
parser (3.0.1.1)
|
28
|
+
ast (~> 2.4.1)
|
30
29
|
pry (0.12.2)
|
31
30
|
coderay (~> 1.1.0)
|
32
31
|
method_source (~> 0.9.0)
|
33
|
-
rack (2.2.
|
32
|
+
rack (2.2.3)
|
34
33
|
rainbow (3.0.0)
|
35
34
|
rake (12.3.3)
|
36
|
-
|
35
|
+
regexp_parser (2.0.3)
|
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,36 +47,39 @@ 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 (
|
51
|
-
jaro_winkler (~> 1.5.1)
|
50
|
+
rubocop (1.18.3)
|
52
51
|
parallel (~> 1.10)
|
53
|
-
parser (>=
|
52
|
+
parser (>= 3.0.0.0)
|
54
53
|
rainbow (>= 2.2.2, < 4.0)
|
54
|
+
regexp_parser (>= 1.8, < 3.0)
|
55
55
|
rexml
|
56
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
56
57
|
ruby-progressbar (~> 1.7)
|
57
|
-
unicode-display_width (>= 1.4.0, <
|
58
|
-
rubocop-
|
59
|
-
|
58
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
59
|
+
rubocop-ast (1.8.0)
|
60
|
+
parser (>= 3.0.1.1)
|
61
|
+
rubocop-rails (2.8.1)
|
62
|
+
activesupport (>= 4.2.0)
|
60
63
|
rack (>= 1.1)
|
61
|
-
rubocop (>= 0.
|
62
|
-
rubocop-rspec (
|
63
|
-
rubocop (
|
64
|
+
rubocop (>= 0.87.0)
|
65
|
+
rubocop-rspec (2.0.0)
|
66
|
+
rubocop (~> 1.0)
|
67
|
+
rubocop-ast (>= 1.1.0)
|
64
68
|
ruby-progressbar (1.10.1)
|
65
|
-
|
66
|
-
|
67
|
-
thread_safe (~> 0.1)
|
69
|
+
tzinfo (2.0.4)
|
70
|
+
concurrent-ruby (~> 1.0)
|
68
71
|
unicode-display_width (1.7.0)
|
69
|
-
zeitwerk (2.
|
72
|
+
zeitwerk (2.4.2)
|
70
73
|
|
71
74
|
PLATFORMS
|
72
75
|
ruby
|
73
76
|
|
74
77
|
DEPENDENCIES
|
75
|
-
bundler (~>
|
78
|
+
bundler (~> 2)
|
76
79
|
pry
|
77
80
|
rake (~> 12.3.1)
|
78
81
|
rspec (~> 3.7)
|
79
82
|
rubocop-g2!
|
80
83
|
|
81
84
|
BUNDLED WITH
|
82
|
-
|
85
|
+
2.2.23
|
data/config/rspec/default.yml
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
- '_spec.rb$'
|
1
|
+
RSpec:
|
2
|
+
Include:
|
3
|
+
- '_spec.rb$'
|
5
4
|
|
6
5
|
Lint/Void:
|
7
6
|
Enabled: false
|
@@ -9,5 +8,8 @@ Lint/Void:
|
|
9
8
|
RSpec/LetSetup:
|
10
9
|
Enabled: false
|
11
10
|
|
11
|
+
RSpec/MultipleMemoizedHelpers:
|
12
|
+
Enabled: false
|
13
|
+
|
12
14
|
RSpec/NestedGroups:
|
13
15
|
Max: 6
|
data/config/ruby/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'
|
data/rubocop-g2.gemspec
CHANGED
@@ -20,11 +20,11 @@ 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.add_dependency 'rubocop', '0.82
|
24
|
-
spec.add_dependency 'rubocop-rails', '2.5
|
25
|
-
spec.add_dependency 'rubocop-rspec', '1.39
|
23
|
+
spec.add_dependency 'rubocop', '>= 0.82'
|
24
|
+
spec.add_dependency 'rubocop-rails', '>= 2.5'
|
25
|
+
spec.add_dependency 'rubocop-rspec', '>= 1.39'
|
26
26
|
|
27
|
-
spec.add_development_dependency 'bundler', '~>
|
27
|
+
spec.add_development_dependency 'bundler', '~> 2'
|
28
28
|
spec.add_development_dependency 'pry'
|
29
29
|
spec.add_development_dependency 'rake', '~> 12.3.1'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-g2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
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: 2021-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.82
|
19
|
+
version: '0.82'
|
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: 0.82
|
26
|
+
version: '0.82'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.5
|
33
|
+
version: '2.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.5
|
40
|
+
version: '2.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.39
|
47
|
+
version: '1.39'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.39
|
54
|
+
version: '1.39'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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,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
|
@@ -136,7 +137,7 @@ files:
|
|
136
137
|
homepage: https://g2.com
|
137
138
|
licenses: []
|
138
139
|
metadata: {}
|
139
|
-
post_install_message:
|
140
|
+
post_install_message:
|
140
141
|
rdoc_options: []
|
141
142
|
require_paths:
|
142
143
|
- lib
|
@@ -151,8 +152,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
152
|
- !ruby/object:Gem::Version
|
152
153
|
version: '0'
|
153
154
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
155
|
-
signing_key:
|
155
|
+
rubygems_version: 3.1.4
|
156
|
+
signing_key:
|
156
157
|
specification_version: 4
|
157
158
|
summary: Custom cops for G2.
|
158
159
|
test_files: []
|