rubocop-erb 0.3.1 → 0.4.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: 8dd1a38dc89ce7ae5d7234726efd075da3475197ef392869ce3a6c3091049829
4
- data.tar.gz: '016658e07334e120f4b3a5a099df1533ca5dc806106d66a4dcb883852ba0812f'
3
+ metadata.gz: 69ccb933a550ae4dfe699ed42350e4c39eb7b2e0e7488915ec3ead433ef1d2be
4
+ data.tar.gz: cf759f1dddd604d8843fccf1bd71fa3a2d8f7a833c08f35048452bb0de18955e
5
5
  SHA512:
6
- metadata.gz: 660537eddd2dbfddde1f6f318b086eaa99ff567f7b90998947efcdc5cdbeea05c9ab97e87263aa0a2b15f4eec35996f9c9e95576bd2711047acc6300a6dd075b
7
- data.tar.gz: 6756de8632f08c1640735251bd3225ead59072aea590f234caf7fca37ca888212eacfedc44228b51508357536b6dbda99cc5585f3e1e9775ee0cde1b7e51083a
6
+ metadata.gz: 65177bdd79e44d0ed83f431c480ec5399ebcd4fb5d196a4c1bab61947984525cc2c2f8aaf6ff3978fd66558d058e8fcf2fb50f88d0c27ed4715613b5426e73f5
7
+ data.tar.gz: 4c2ecc5c6b0be161bb72799e17761d50b5dc8387d1ae1de6043ed8dc02dfd2a16093ed49c5ca529e93c6e3d004079406d345e5d5155e883dd4527e0c4be09f65
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.0)
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)
@@ -33,30 +33,30 @@ GEM
33
33
  erubi (~> 1.4)
34
34
  parser (>= 2.4)
35
35
  smart_properties
36
- bigdecimal (3.1.5)
36
+ bigdecimal (3.1.6)
37
37
  builder (3.2.4)
38
- concurrent-ruby (1.2.2)
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
41
+ diff-lcs (1.5.1)
42
+ drb (2.2.1)
44
43
  erubi (1.12.0)
45
- i18n (1.14.1)
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.2-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!
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-erb (0.3.0)
4
+ rubocop-erb (0.4.0)
5
5
  better_html
6
6
  rubocop (~> 1.45)
7
7
 
@@ -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.0'
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.0
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-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_html