rubocop-erb 0.3.1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8dd1a38dc89ce7ae5d7234726efd075da3475197ef392869ce3a6c3091049829
4
- data.tar.gz: '016658e07334e120f4b3a5a099df1533ca5dc806106d66a4dcb883852ba0812f'
3
+ metadata.gz: c57699be856b07c099f05fb62bdb69d656e008af86319f739c5e35a902628f84
4
+ data.tar.gz: 5094efa6732c052e82eb56a44c3547dc52af06594b5a7cc648f63d4bcd39ac8e
5
5
  SHA512:
6
- metadata.gz: 660537eddd2dbfddde1f6f318b086eaa99ff567f7b90998947efcdc5cdbeea05c9ab97e87263aa0a2b15f4eec35996f9c9e95576bd2711047acc6300a6dd075b
7
- data.tar.gz: 6756de8632f08c1640735251bd3225ead59072aea590f234caf7fca37ca888212eacfedc44228b51508357536b6dbda99cc5585f3e1e9775ee0cde1b7e51083a
6
+ metadata.gz: bf57a7afa7c9990b85dc9028d0bf0353c076cd8cf37702e329d6d1bbe911d34f557d48d5ce324c8400f3679e6bdcd85c27977a01d7a61567d4b0bdfcd753c26e
7
+ data.tar.gz: a9307f9f21a006152684219c01a4d683df8259eb155872c2dbf96be15d995a60924238b71648d0bda6987f01450ff5189177b5f4d5bbfaa2b8617b4a5959f92e
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in rubocop-erb.gemspec
6
6
  gemspec
7
7
 
8
+ gem 'prism'
8
9
  gem 'rake'
9
10
  gem 'rspec'
10
11
  gem 'rubocop-rake'
data/Gemfile.lock CHANGED
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-erb (0.3.1)
4
+ rubocop-erb (0.4.1)
5
5
  better_html
6
6
  rubocop (~> 1.45)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionview (7.1.2)
12
- activesupport (= 7.1.2)
11
+ actionview (7.1.3.2)
12
+ activesupport (= 7.1.3.2)
13
13
  builder (~> 3.1)
14
14
  erubi (~> 1.11)
15
15
  rails-dom-testing (~> 2.2)
16
16
  rails-html-sanitizer (~> 1.6)
17
- activesupport (7.1.2)
17
+ activesupport (7.1.3.2)
18
18
  base64
19
19
  bigdecimal
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -26,37 +26,37 @@ GEM
26
26
  tzinfo (~> 2.0)
27
27
  ast (2.4.2)
28
28
  base64 (0.2.0)
29
- better_html (2.0.2)
29
+ better_html (2.1.1)
30
30
  actionview (>= 6.0)
31
31
  activesupport (>= 6.0)
32
32
  ast (~> 2.0)
33
33
  erubi (~> 1.4)
34
34
  parser (>= 2.4)
35
35
  smart_properties
36
- bigdecimal (3.1.5)
37
- builder (3.2.4)
38
- concurrent-ruby (1.2.2)
36
+ bigdecimal (3.1.6)
37
+ builder (3.3.0)
38
+ concurrent-ruby (1.2.3)
39
39
  connection_pool (2.4.1)
40
40
  crass (1.0.6)
41
- diff-lcs (1.5.0)
42
- drb (2.2.0)
43
- ruby2_keywords
44
- erubi (1.12.0)
45
- i18n (1.14.1)
41
+ diff-lcs (1.5.1)
42
+ drb (2.2.1)
43
+ erubi (1.13.0)
44
+ i18n (1.14.4)
46
45
  concurrent-ruby (~> 1.0)
47
46
  json (2.7.1)
48
47
  language_server-protocol (3.17.0.3)
49
48
  loofah (2.22.0)
50
49
  crass (~> 1.0.2)
51
50
  nokogiri (>= 1.12.0)
52
- minitest (5.20.0)
51
+ minitest (5.22.2)
53
52
  mutex_m (0.2.0)
54
- nokogiri (1.16.0-x86_64-linux)
53
+ nokogiri (1.16.6-x86_64-linux)
55
54
  racc (~> 1.4)
56
55
  parallel (1.24.0)
57
- parser (3.3.0.2)
56
+ parser (3.3.0.5)
58
57
  ast (~> 2.4.1)
59
58
  racc
59
+ prism (0.24.0)
60
60
  racc (1.7.3)
61
61
  rails-dom-testing (2.2.0)
62
62
  activesupport (>= 5.0.0)
@@ -67,47 +67,46 @@ GEM
67
67
  nokogiri (~> 1.14)
68
68
  rainbow (3.1.1)
69
69
  rake (13.1.0)
70
- regexp_parser (2.8.3)
70
+ regexp_parser (2.9.0)
71
71
  rexml (3.2.6)
72
- rspec (3.12.0)
73
- rspec-core (~> 3.12.0)
74
- rspec-expectations (~> 3.12.0)
75
- rspec-mocks (~> 3.12.0)
76
- rspec-core (3.12.2)
77
- rspec-support (~> 3.12.0)
78
- rspec-expectations (3.12.3)
72
+ rspec (3.13.0)
73
+ rspec-core (~> 3.13.0)
74
+ rspec-expectations (~> 3.13.0)
75
+ rspec-mocks (~> 3.13.0)
76
+ rspec-core (3.13.0)
77
+ rspec-support (~> 3.13.0)
78
+ rspec-expectations (3.13.0)
79
79
  diff-lcs (>= 1.2.0, < 2.0)
80
- rspec-support (~> 3.12.0)
81
- rspec-mocks (3.12.6)
80
+ rspec-support (~> 3.13.0)
81
+ rspec-mocks (3.13.0)
82
82
  diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.12.0)
84
- rspec-support (3.12.1)
85
- rubocop (1.59.0)
83
+ rspec-support (~> 3.13.0)
84
+ rspec-support (3.13.1)
85
+ rubocop (1.62.0)
86
86
  json (~> 2.3)
87
87
  language_server-protocol (>= 3.17.0)
88
88
  parallel (~> 1.10)
89
- parser (>= 3.2.2.4)
89
+ parser (>= 3.3.0.2)
90
90
  rainbow (>= 2.2.2, < 4.0)
91
91
  regexp_parser (>= 1.8, < 3.0)
92
92
  rexml (>= 3.2.5, < 4.0)
93
- rubocop-ast (>= 1.30.0, < 2.0)
93
+ rubocop-ast (>= 1.31.1, < 2.0)
94
94
  ruby-progressbar (~> 1.7)
95
95
  unicode-display_width (>= 2.4.0, < 3.0)
96
- rubocop-ast (1.30.0)
97
- parser (>= 3.2.1.0)
96
+ rubocop-ast (1.31.1)
97
+ parser (>= 3.3.0.4)
98
98
  rubocop-capybara (2.20.0)
99
99
  rubocop (~> 1.41)
100
100
  rubocop-factory_bot (2.25.1)
101
101
  rubocop (~> 1.41)
102
102
  rubocop-rake (0.6.0)
103
103
  rubocop (~> 1.0)
104
- rubocop-rspec (2.26.1)
104
+ rubocop-rspec (2.27.1)
105
105
  rubocop (~> 1.40)
106
106
  rubocop-capybara (~> 2.17)
107
107
  rubocop-factory_bot (~> 2.22)
108
108
  ruby-progressbar (1.13.0)
109
- ruby2_keywords (0.0.5)
110
- sevencop (0.35.1)
109
+ sevencop (0.38.0)
111
110
  activesupport
112
111
  rubocop
113
112
  smart_properties (1.17.0)
@@ -119,6 +118,7 @@ PLATFORMS
119
118
  x86_64-linux
120
119
 
121
120
  DEPENDENCIES
121
+ prism
122
122
  rake
123
123
  rspec
124
124
  rubocop-erb!
data/config/default.yml CHANGED
@@ -79,6 +79,10 @@ Layout/LeadingEmptyLine:
79
79
  Exclude:
80
80
  - '**/*.erb'
81
81
 
82
+ Layout/LeadingEmptyLines:
83
+ Exclude:
84
+ - '**/*.erb'
85
+
82
86
  Layout/LineEndStringConcatenationIndentation:
83
87
  Exclude:
84
88
  - '**/*.erb'
@@ -131,6 +135,10 @@ Lint/EmptyFile:
131
135
  Exclude:
132
136
  - '**/*.erb'
133
137
 
138
+ Lint/OutOfRangeRegexpRef:
139
+ Exclude:
140
+ - '**/*.erb'
141
+
134
142
  Lint/SyntaxError:
135
143
  Exclude:
136
144
  - '**/*.erb'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-erb (0.3.0)
4
+ rubocop-erb (0.4.1)
5
5
  better_html
6
6
  rubocop (~> 1.45)
7
7
 
@@ -26,7 +26,7 @@ GEM
26
26
  tzinfo (~> 2.0)
27
27
  ast (2.4.2)
28
28
  base64 (0.2.0)
29
- better_html (2.0.2)
29
+ better_html (2.1.1)
30
30
  actionview (>= 6.0)
31
31
  activesupport (>= 6.0)
32
32
  ast (~> 2.0)
@@ -34,14 +34,14 @@ GEM
34
34
  parser (>= 2.4)
35
35
  smart_properties
36
36
  bigdecimal (3.1.5)
37
- builder (3.2.4)
37
+ builder (3.3.0)
38
38
  concurrent-ruby (1.2.2)
39
39
  connection_pool (2.4.1)
40
40
  crass (1.0.6)
41
41
  diff-lcs (1.5.0)
42
42
  drb (2.2.0)
43
43
  ruby2_keywords
44
- erubi (1.12.0)
44
+ erubi (1.13.0)
45
45
  i18n (1.14.1)
46
46
  concurrent-ruby (~> 1.0)
47
47
  json (2.7.1)
@@ -26,16 +26,9 @@ module RuboCop
26
26
  return unless supported_file_path_pattern?
27
27
 
28
28
  ruby_clips.map do |ruby_clip|
29
- processed_source = ::RuboCop::ProcessedSource.new(
30
- ruby_clip.code,
31
- @processed_source.ruby_version,
32
- file_path
33
- )
34
- processed_source.config = @processed_source.config
35
- processed_source.registry = @processed_source.registry
36
29
  {
37
30
  offset: ruby_clip.offset,
38
- processed_source: processed_source
31
+ processed_source: ruby_clip_to_processed_source(ruby_clip)
39
32
  }
40
33
  end
41
34
  end
@@ -73,6 +66,28 @@ module RuboCop
73
66
  ).ast
74
67
  end
75
68
 
69
+ # @return [RuboCop::ProcessedSource]
70
+ def ruby_clip_to_processed_source(ruby_clip)
71
+ supports_prism = @processed_source.respond_to?(:parser_engine)
72
+ processed_source = if supports_prism
73
+ ::RuboCop::ProcessedSource.new(
74
+ ruby_clip.code,
75
+ @processed_source.ruby_version,
76
+ file_path,
77
+ parser_engine: @processed_source.parser_engine
78
+ )
79
+ else
80
+ ::RuboCop::ProcessedSource.new(
81
+ ruby_clip.code,
82
+ @processed_source.ruby_version,
83
+ file_path
84
+ )
85
+ end
86
+ processed_source.config = @processed_source.config
87
+ processed_source.registry = @processed_source.registry
88
+ processed_source
89
+ end
90
+
76
91
  # @return [Array<RuboCop::Erb::RubyClip>]
77
92
  def ruby_clips
78
93
  nodes.map do |node|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Erb
5
- VERSION = '0.3.1'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-erb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-11 00:00:00.000000000 Z
11
+ date: 2024-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_html
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  requirements: []
90
- rubygems_version: 3.3.26
90
+ rubygems_version: 3.3.27
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: RuboCop plugin for ERB template.