rubocop-erb 0.5.5 → 0.7.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 +4 -4
- data/.rubocop.yml +4 -2
- data/Gemfile.lock +50 -67
- data/README.md +4 -1
- data/lib/rubocop/erb/keyword_remover.rb +5 -5
- data/lib/rubocop/erb/plugin.rb +33 -0
- data/lib/rubocop/erb/processed_source_builder.rb +1 -12
- data/lib/rubocop/erb/ruby_extractor.rb +36 -41
- data/lib/rubocop/erb/version.rb +1 -1
- data/lib/rubocop/erb/when_decomposer.rb +1 -1
- data/lib/rubocop/erb.rb +1 -2
- data/rubocop-erb.gemspec +5 -3
- metadata +36 -18
- data/gemfiles/ruby_2.7.gemfile +0 -13
- data/gemfiles/ruby_2.7.gemfile.lock +0 -134
- data/lib/rubocop/erb/config_loader.rb +0 -50
- data/lib/rubocop/erb/rubocop_extension.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 543291fcf8f7203bc704dd84084df69318f1f596c4ad5ba26d4a904c06472b74
|
4
|
+
data.tar.gz: 490f8db2895f273c1818e70dcb656deee3287b3d16a3e7f60a02307619582634
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3abc86fed80b72f45ac335be071ffc50f90a5160ae8bbc7e2a4e8ecfec9bd0e239ba481793f0f745439224dc10f45985c9d1d812a3262d240ab2ccb212698e7
|
7
|
+
data.tar.gz: ca7e099b8b8821c788d4e5ad3ea96e470eda7b13ff94f09e6b90cf498919d4ae7a972c8fcafba99d1e6e65fab280bd159bfc559ba9aff0d08f750e549b6a1137
|
data/.rubocop.yml
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
plugins:
|
2
2
|
- rubocop-erb
|
3
3
|
- rubocop-rake
|
4
4
|
- rubocop-rspec
|
5
|
+
|
6
|
+
require:
|
5
7
|
- sevencop
|
6
8
|
|
7
9
|
inherit_mode:
|
@@ -12,7 +14,7 @@ AllCops:
|
|
12
14
|
Exclude:
|
13
15
|
- spec/**/*.erb
|
14
16
|
NewCops: enable
|
15
|
-
TargetRubyVersion:
|
17
|
+
TargetRubyVersion: 3.0
|
16
18
|
|
17
19
|
Gemspec/RequireMFA:
|
18
20
|
Enabled: false
|
data/Gemfile.lock
CHANGED
@@ -1,116 +1,99 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-erb (0.
|
5
|
-
|
6
|
-
|
4
|
+
rubocop-erb (0.7.0)
|
5
|
+
herb (~> 0.7)
|
6
|
+
lint_roller (~> 1.1)
|
7
|
+
rubocop (~> 1.72, >= 1.72.1)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
|
12
|
-
activesupport (= 7.1.3.4)
|
13
|
-
builder (~> 3.1)
|
14
|
-
erubi (~> 1.11)
|
15
|
-
rails-dom-testing (~> 2.2)
|
16
|
-
rails-html-sanitizer (~> 1.6)
|
17
|
-
activesupport (7.1.3.4)
|
12
|
+
activesupport (7.1.5.1)
|
18
13
|
base64
|
14
|
+
benchmark (>= 0.3)
|
19
15
|
bigdecimal
|
20
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
17
|
connection_pool (>= 2.2.5)
|
22
18
|
drb
|
23
19
|
i18n (>= 1.6, < 2)
|
20
|
+
logger (>= 1.4.2)
|
24
21
|
minitest (>= 5.1)
|
25
22
|
mutex_m
|
23
|
+
securerandom (>= 0.3)
|
26
24
|
tzinfo (~> 2.0)
|
27
25
|
ast (2.4.2)
|
28
26
|
base64 (0.2.0)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
parser (>= 2.4)
|
35
|
-
smart_properties
|
36
|
-
bigdecimal (3.1.8)
|
37
|
-
builder (3.3.0)
|
38
|
-
concurrent-ruby (1.3.3)
|
39
|
-
connection_pool (2.4.1)
|
40
|
-
crass (1.0.6)
|
41
|
-
diff-lcs (1.5.1)
|
27
|
+
benchmark (0.4.0)
|
28
|
+
bigdecimal (3.1.9)
|
29
|
+
concurrent-ruby (1.3.5)
|
30
|
+
connection_pool (2.5.0)
|
31
|
+
diff-lcs (1.6.0)
|
42
32
|
drb (2.2.1)
|
43
|
-
|
44
|
-
|
33
|
+
herb (0.7.1)
|
34
|
+
herb (0.7.1-x86_64-linux-gnu)
|
35
|
+
i18n (1.14.7)
|
45
36
|
concurrent-ruby (~> 1.0)
|
46
|
-
json (2.
|
47
|
-
language_server-protocol (3.17.0.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
racc (~> 1.4)
|
55
|
-
parallel (1.25.1)
|
56
|
-
parser (3.3.4.0)
|
37
|
+
json (2.10.1)
|
38
|
+
language_server-protocol (3.17.0.4)
|
39
|
+
lint_roller (1.1.0)
|
40
|
+
logger (1.6.6)
|
41
|
+
minitest (5.25.4)
|
42
|
+
mutex_m (0.3.0)
|
43
|
+
parallel (1.26.3)
|
44
|
+
parser (3.3.7.1)
|
57
45
|
ast (~> 2.4.1)
|
58
46
|
racc
|
59
|
-
prism (
|
47
|
+
prism (1.3.0)
|
60
48
|
racc (1.8.1)
|
61
|
-
rails-dom-testing (2.2.0)
|
62
|
-
activesupport (>= 5.0.0)
|
63
|
-
minitest
|
64
|
-
nokogiri (>= 1.6)
|
65
|
-
rails-html-sanitizer (1.6.1)
|
66
|
-
loofah (~> 2.21)
|
67
|
-
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
68
49
|
rainbow (3.1.1)
|
69
50
|
rake (13.2.1)
|
70
|
-
regexp_parser (2.
|
71
|
-
rexml (3.3.4)
|
72
|
-
strscan
|
51
|
+
regexp_parser (2.10.0)
|
73
52
|
rspec (3.13.0)
|
74
53
|
rspec-core (~> 3.13.0)
|
75
54
|
rspec-expectations (~> 3.13.0)
|
76
55
|
rspec-mocks (~> 3.13.0)
|
77
|
-
rspec-core (3.13.
|
56
|
+
rspec-core (3.13.3)
|
78
57
|
rspec-support (~> 3.13.0)
|
79
|
-
rspec-expectations (3.13.
|
58
|
+
rspec-expectations (3.13.3)
|
80
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
60
|
rspec-support (~> 3.13.0)
|
82
|
-
rspec-mocks (3.13.
|
61
|
+
rspec-mocks (3.13.2)
|
83
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
84
63
|
rspec-support (~> 3.13.0)
|
85
|
-
rspec-support (3.13.
|
86
|
-
rubocop (1.
|
64
|
+
rspec-support (3.13.2)
|
65
|
+
rubocop (1.72.2)
|
87
66
|
json (~> 2.3)
|
88
|
-
language_server-protocol (
|
67
|
+
language_server-protocol (~> 3.17.0.2)
|
68
|
+
lint_roller (~> 1.1.0)
|
89
69
|
parallel (~> 1.10)
|
90
70
|
parser (>= 3.3.0.2)
|
91
71
|
rainbow (>= 2.2.2, < 4.0)
|
92
|
-
regexp_parser (>= 2.
|
93
|
-
|
94
|
-
rubocop-ast (>= 1.31.1, < 2.0)
|
72
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
73
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
95
74
|
ruby-progressbar (~> 1.7)
|
96
|
-
unicode-display_width (>= 2.4.0, <
|
97
|
-
rubocop-ast (1.
|
75
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
76
|
+
rubocop-ast (1.38.0)
|
98
77
|
parser (>= 3.3.1.0)
|
99
|
-
rubocop-rake (0.
|
100
|
-
|
101
|
-
|
102
|
-
|
78
|
+
rubocop-rake (0.7.1)
|
79
|
+
lint_roller (~> 1.1)
|
80
|
+
rubocop (>= 1.72.1)
|
81
|
+
rubocop-rspec (3.5.0)
|
82
|
+
lint_roller (~> 1.1)
|
83
|
+
rubocop (~> 1.72, >= 1.72.1)
|
103
84
|
ruby-progressbar (1.13.0)
|
104
|
-
|
85
|
+
securerandom (0.3.2)
|
86
|
+
sevencop (0.47.0)
|
105
87
|
activesupport
|
106
88
|
rubocop
|
107
|
-
smart_properties (1.17.0)
|
108
|
-
strscan (3.1.0)
|
109
89
|
tzinfo (2.0.6)
|
110
90
|
concurrent-ruby (~> 1.0)
|
111
|
-
unicode-display_width (
|
91
|
+
unicode-display_width (3.1.4)
|
92
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
93
|
+
unicode-emoji (4.0.4)
|
112
94
|
|
113
95
|
PLATFORMS
|
96
|
+
ruby
|
114
97
|
x86_64-linux
|
115
98
|
|
116
99
|
DEPENDENCIES
|
@@ -123,4 +106,4 @@ DEPENDENCIES
|
|
123
106
|
sevencop
|
124
107
|
|
125
108
|
BUNDLED WITH
|
126
|
-
2.
|
109
|
+
2.5.23
|
data/README.md
CHANGED
@@ -24,10 +24,13 @@ Require `rubocop-erb` in your RuboCop config.
|
|
24
24
|
|
25
25
|
```yaml
|
26
26
|
# .rubocop.yml
|
27
|
-
|
27
|
+
plugins:
|
28
28
|
- rubocop-erb
|
29
29
|
```
|
30
30
|
|
31
|
+
> [!NOTE]
|
32
|
+
> The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
|
33
|
+
|
31
34
|
Now you can use RuboCop also for ERB templates.
|
32
35
|
|
33
36
|
```
|
@@ -87,7 +87,7 @@ module RuboCop
|
|
87
87
|
| for[ \t]+\w+[ \t]+in
|
88
88
|
)
|
89
89
|
\b[ \t]*
|
90
|
-
/x
|
90
|
+
/x
|
91
91
|
end
|
92
92
|
|
93
93
|
# Remove preceding `}`.
|
@@ -96,7 +96,7 @@ module RuboCop
|
|
96
96
|
\A
|
97
97
|
\s*
|
98
98
|
}
|
99
|
-
/x
|
99
|
+
/x
|
100
100
|
end
|
101
101
|
|
102
102
|
class TrailingSourceRemover
|
@@ -130,7 +130,7 @@ module RuboCop
|
|
130
130
|
(?:\|[^|]*\|)?
|
131
131
|
\s*
|
132
132
|
\z
|
133
|
-
/x
|
133
|
+
/x
|
134
134
|
end
|
135
135
|
|
136
136
|
# Remove trailing `then`.
|
@@ -140,7 +140,7 @@ module RuboCop
|
|
140
140
|
then
|
141
141
|
\s*
|
142
142
|
\z
|
143
|
-
/x
|
143
|
+
/x
|
144
144
|
end
|
145
145
|
|
146
146
|
# Remove trailing `do`.
|
@@ -153,7 +153,7 @@ module RuboCop
|
|
153
153
|
\s*
|
154
154
|
(\#.*)?
|
155
155
|
\z
|
156
|
-
/x
|
156
|
+
/x
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lint_roller'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Erb
|
7
|
+
# A plugin that integrates rubocop-erb with RuboCop's plugin system.
|
8
|
+
class Plugin < LintRoller::Plugin
|
9
|
+
def about
|
10
|
+
LintRoller::About.new(
|
11
|
+
description: 'RuboCop plugin for ERB template.',
|
12
|
+
homepage: 'https://github.com/r7kamura/rubocop-erb',
|
13
|
+
name: 'rubocop-erb',
|
14
|
+
version: VERSION
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def rules(_context)
|
19
|
+
RuboCop::Runner.ruby_extractors.unshift(RuboCop::Erb::RubyExtractor)
|
20
|
+
|
21
|
+
LintRoller::Rules.new(
|
22
|
+
config_format: :rubocop,
|
23
|
+
type: :path,
|
24
|
+
value: Pathname.new(__dir__).join('../../../config/default.yml')
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def supported?(context)
|
29
|
+
context.engine == :rubocop
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -33,23 +33,12 @@ module RuboCop
|
|
33
33
|
@code,
|
34
34
|
@processed_source.ruby_version,
|
35
35
|
@processed_source.path,
|
36
|
-
|
36
|
+
parser_engine: @processed_source.parser_engine
|
37
37
|
)
|
38
38
|
new_processed_source.config = @processed_source.config
|
39
39
|
new_processed_source.registry = @processed_source.registry
|
40
40
|
new_processed_source
|
41
41
|
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
# @return [Hash]
|
46
|
-
def keyword_arguments
|
47
|
-
if @processed_source.respond_to?(:parser_engine)
|
48
|
-
{ parser_engine: @processed_source.parser_engine }
|
49
|
-
else
|
50
|
-
{}
|
51
|
-
end
|
52
|
-
end
|
53
42
|
end
|
54
43
|
end
|
55
44
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'better_html/parser'
|
3
|
+
require 'herb'
|
5
4
|
require 'rubocop'
|
6
5
|
|
7
6
|
module RuboCop
|
@@ -38,43 +37,31 @@ module RuboCop
|
|
38
37
|
|
39
38
|
private
|
40
39
|
|
41
|
-
# @return [Array<BetterHtml::AST::Node>]
|
42
|
-
def erbs
|
43
|
-
root.descendants(:erb).reject do |node|
|
44
|
-
erb_node = ErbNode.new(node)
|
45
|
-
erb_node.comment? || erb_node.escape?
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
40
|
# @return [String, nil]
|
50
41
|
def file_path
|
51
42
|
@processed_source.path
|
52
43
|
end
|
53
44
|
|
54
|
-
# @return [
|
45
|
+
# @return [Array<Herb::AST::Node>]
|
55
46
|
def nodes
|
56
|
-
|
57
|
-
|
58
|
-
|
47
|
+
visitor = ErbNodeVisitor.new
|
48
|
+
visitor.visit(root)
|
49
|
+
visitor.erb_nodes
|
59
50
|
end
|
60
51
|
|
61
|
-
# @return [
|
52
|
+
# @return [Herb::AST::DocumentNode]
|
62
53
|
def root
|
63
|
-
::
|
64
|
-
::Parser::Source::Buffer.new(
|
65
|
-
file_path,
|
66
|
-
source: template_source
|
67
|
-
),
|
68
|
-
template_language: :html
|
69
|
-
).ast
|
54
|
+
::Herb.parse(template_source).value
|
70
55
|
end
|
71
56
|
|
72
57
|
# @return [Array<RuboCop::Erb::RubyClip>]
|
73
58
|
def ruby_clips
|
74
59
|
nodes.map do |node|
|
60
|
+
erb_start_location = node.content.location.start
|
61
|
+
line_range = @processed_source.buffer.line_range(erb_start_location.line)
|
75
62
|
RubyClip.new(
|
76
|
-
code: node.
|
77
|
-
offset:
|
63
|
+
code: node.content.value,
|
64
|
+
offset: line_range.begin.begin_pos + erb_start_location.column
|
78
65
|
)
|
79
66
|
end.flat_map do |ruby_clip|
|
80
67
|
WhenDecomposer.call(@processed_source, ruby_clip)
|
@@ -95,34 +82,42 @@ module RuboCop
|
|
95
82
|
@processed_source.raw_source
|
96
83
|
end
|
97
84
|
|
98
|
-
class
|
99
|
-
# @
|
100
|
-
def
|
101
|
-
|
85
|
+
class ErbNodeVisitor < Herb::Visitor
|
86
|
+
# @return [Array<Symbol>]
|
87
|
+
def self.erb_visitor_methods
|
88
|
+
instance_methods.select { |method_name| method_name.to_s.start_with?('visit_erb_') }
|
102
89
|
end
|
103
90
|
|
104
|
-
|
105
|
-
|
106
|
-
|
91
|
+
attr_reader :erb_nodes
|
92
|
+
|
93
|
+
def initialize
|
94
|
+
@erb_nodes = []
|
95
|
+
super
|
107
96
|
end
|
108
97
|
|
109
98
|
# @return [Boolean]
|
110
|
-
def
|
111
|
-
|
99
|
+
def comment?(node)
|
100
|
+
node.tag_opening.value == '<%#'
|
112
101
|
end
|
113
102
|
|
114
|
-
|
103
|
+
# @return [Boolean]
|
104
|
+
def escape?(node)
|
105
|
+
node.tag_opening.value == '<%%'
|
106
|
+
end
|
115
107
|
|
116
|
-
|
117
|
-
|
118
|
-
|
108
|
+
erb_visitor_methods.each do |method_name|
|
109
|
+
class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
|
110
|
+
def #{method_name}(node) # def visit_erb_content_node(node)
|
111
|
+
record_node(node) # record_node(node)
|
112
|
+
super # super
|
113
|
+
end # end
|
114
|
+
RUBY
|
119
115
|
end
|
120
116
|
|
121
|
-
|
122
|
-
|
123
|
-
return unless first_child&.type == :indicator
|
117
|
+
def record_node(node)
|
118
|
+
return if comment?(node) || escape?(node)
|
124
119
|
|
125
|
-
|
120
|
+
@erb_nodes << node
|
126
121
|
end
|
127
122
|
end
|
128
123
|
end
|
data/lib/rubocop/erb/version.rb
CHANGED
data/lib/rubocop/erb.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
module RuboCop
|
4
4
|
module Erb
|
5
|
-
autoload :ConfigLoader, 'rubocop/erb/config_loader'
|
6
5
|
autoload :KeywordRemover, 'rubocop/erb/keyword_remover'
|
7
6
|
autoload :ProcessedSourceBuilder, 'rubocop/erb/processed_source_builder'
|
8
7
|
autoload :RubyClip, 'rubocop/erb/ruby_clip'
|
@@ -11,5 +10,5 @@ module RuboCop
|
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
14
|
-
require_relative 'erb/
|
13
|
+
require_relative 'erb/plugin'
|
15
14
|
require_relative 'erb/version'
|
data/rubocop-erb.gemspec
CHANGED
@@ -11,11 +11,12 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = 'RuboCop plugin for ERB template.'
|
12
12
|
spec.homepage = 'https://github.com/r7kamura/rubocop-erb'
|
13
13
|
spec.license = 'MIT'
|
14
|
-
spec.required_ruby_version = '>=
|
14
|
+
spec.required_ruby_version = '>= 3.0'
|
15
15
|
|
16
16
|
spec.metadata['homepage_uri'] = spec.homepage
|
17
17
|
spec.metadata['source_code_uri'] = spec.homepage
|
18
18
|
spec.metadata['changelog_uri'] = "#{spec.homepage}/releases"
|
19
|
+
spec.metadata['default_lint_roller_plugin'] = 'RuboCop::Erb::Plugin'
|
19
20
|
|
20
21
|
# Specify which files should be added to the gem when it is released.
|
21
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -28,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
28
29
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
30
|
spec.require_paths = ['lib']
|
30
31
|
|
31
|
-
spec.add_dependency '
|
32
|
-
spec.add_dependency '
|
32
|
+
spec.add_dependency 'herb', '~> 0.7'
|
33
|
+
spec.add_dependency 'lint_roller', '~> 1.1'
|
34
|
+
spec.add_dependency 'rubocop', '~> 1.72', '>= 1.72.1'
|
33
35
|
end
|
metadata
CHANGED
@@ -1,44 +1,64 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-erb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: herb
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.7'
|
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'
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: lint_roller
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rubocop
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
47
|
+
version: '1.72'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 1.72.1
|
34
51
|
type: :runtime
|
35
52
|
prerelease: false
|
36
53
|
version_requirements: !ruby/object:Gem::Requirement
|
37
54
|
requirements:
|
38
55
|
- - "~>"
|
39
56
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
41
|
-
|
57
|
+
version: '1.72'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.72.1
|
61
|
+
description:
|
42
62
|
email:
|
43
63
|
- r7kamura@gmail.com
|
44
64
|
executables: []
|
@@ -54,13 +74,10 @@ files:
|
|
54
74
|
- README.md
|
55
75
|
- Rakefile
|
56
76
|
- config/default.yml
|
57
|
-
- gemfiles/ruby_2.7.gemfile
|
58
|
-
- gemfiles/ruby_2.7.gemfile.lock
|
59
77
|
- lib/rubocop/erb.rb
|
60
|
-
- lib/rubocop/erb/config_loader.rb
|
61
78
|
- lib/rubocop/erb/keyword_remover.rb
|
79
|
+
- lib/rubocop/erb/plugin.rb
|
62
80
|
- lib/rubocop/erb/processed_source_builder.rb
|
63
|
-
- lib/rubocop/erb/rubocop_extension.rb
|
64
81
|
- lib/rubocop/erb/ruby_clip.rb
|
65
82
|
- lib/rubocop/erb/ruby_extractor.rb
|
66
83
|
- lib/rubocop/erb/version.rb
|
@@ -73,7 +90,8 @@ metadata:
|
|
73
90
|
homepage_uri: https://github.com/r7kamura/rubocop-erb
|
74
91
|
source_code_uri: https://github.com/r7kamura/rubocop-erb
|
75
92
|
changelog_uri: https://github.com/r7kamura/rubocop-erb/releases
|
76
|
-
|
93
|
+
default_lint_roller_plugin: RuboCop::Erb::Plugin
|
94
|
+
post_install_message:
|
77
95
|
rdoc_options: []
|
78
96
|
require_paths:
|
79
97
|
- lib
|
@@ -81,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
99
|
requirements:
|
82
100
|
- - ">="
|
83
101
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
102
|
+
version: '3.0'
|
85
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
104
|
requirements:
|
87
105
|
- - ">="
|
@@ -89,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
107
|
version: '0'
|
90
108
|
requirements: []
|
91
109
|
rubygems_version: 3.3.27
|
92
|
-
signing_key:
|
110
|
+
signing_key:
|
93
111
|
specification_version: 4
|
94
112
|
summary: RuboCop plugin for ERB template.
|
95
113
|
test_files: []
|
data/gemfiles/ruby_2.7.gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gemspec path: '..'
|
6
|
-
|
7
|
-
gem 'better_html', '< 2.1' # 2.1 dropped ruby 2.7 support.
|
8
|
-
gem 'nokogiri', '~> 1.15.0'
|
9
|
-
gem 'rake'
|
10
|
-
gem 'rspec'
|
11
|
-
gem 'rubocop-rake'
|
12
|
-
gem 'rubocop-rspec'
|
13
|
-
gem 'sevencop'
|
@@ -1,134 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
rubocop-erb (0.5.5)
|
5
|
-
better_html
|
6
|
-
rubocop (~> 1.45)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
actionview (7.1.2)
|
12
|
-
activesupport (= 7.1.2)
|
13
|
-
builder (~> 3.1)
|
14
|
-
erubi (~> 1.11)
|
15
|
-
rails-dom-testing (~> 2.2)
|
16
|
-
rails-html-sanitizer (~> 1.6)
|
17
|
-
activesupport (7.1.2)
|
18
|
-
base64
|
19
|
-
bigdecimal
|
20
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
|
-
connection_pool (>= 2.2.5)
|
22
|
-
drb
|
23
|
-
i18n (>= 1.6, < 2)
|
24
|
-
minitest (>= 5.1)
|
25
|
-
mutex_m
|
26
|
-
tzinfo (~> 2.0)
|
27
|
-
ast (2.4.2)
|
28
|
-
base64 (0.2.0)
|
29
|
-
better_html (2.0.2)
|
30
|
-
actionview (>= 6.0)
|
31
|
-
activesupport (>= 6.0)
|
32
|
-
ast (~> 2.0)
|
33
|
-
erubi (~> 1.4)
|
34
|
-
parser (>= 2.4)
|
35
|
-
smart_properties
|
36
|
-
bigdecimal (3.1.5)
|
37
|
-
builder (3.3.0)
|
38
|
-
concurrent-ruby (1.2.2)
|
39
|
-
connection_pool (2.4.1)
|
40
|
-
crass (1.0.6)
|
41
|
-
diff-lcs (1.5.0)
|
42
|
-
drb (2.2.0)
|
43
|
-
ruby2_keywords
|
44
|
-
erubi (1.13.0)
|
45
|
-
i18n (1.14.1)
|
46
|
-
concurrent-ruby (~> 1.0)
|
47
|
-
json (2.7.1)
|
48
|
-
language_server-protocol (3.17.0.3)
|
49
|
-
loofah (2.22.0)
|
50
|
-
crass (~> 1.0.2)
|
51
|
-
nokogiri (>= 1.12.0)
|
52
|
-
mini_portile2 (2.8.7)
|
53
|
-
minitest (5.20.0)
|
54
|
-
mutex_m (0.2.0)
|
55
|
-
nokogiri (1.15.5)
|
56
|
-
mini_portile2 (~> 2.8.2)
|
57
|
-
racc (~> 1.4)
|
58
|
-
parallel (1.24.0)
|
59
|
-
parser (3.3.0.2)
|
60
|
-
ast (~> 2.4.1)
|
61
|
-
racc
|
62
|
-
racc (1.7.3)
|
63
|
-
rails-dom-testing (2.2.0)
|
64
|
-
activesupport (>= 5.0.0)
|
65
|
-
minitest
|
66
|
-
nokogiri (>= 1.6)
|
67
|
-
rails-html-sanitizer (1.6.0)
|
68
|
-
loofah (~> 2.21)
|
69
|
-
nokogiri (~> 1.14)
|
70
|
-
rainbow (3.1.1)
|
71
|
-
rake (13.1.0)
|
72
|
-
regexp_parser (2.8.3)
|
73
|
-
rexml (3.2.6)
|
74
|
-
rspec (3.12.0)
|
75
|
-
rspec-core (~> 3.12.0)
|
76
|
-
rspec-expectations (~> 3.12.0)
|
77
|
-
rspec-mocks (~> 3.12.0)
|
78
|
-
rspec-core (3.12.2)
|
79
|
-
rspec-support (~> 3.12.0)
|
80
|
-
rspec-expectations (3.12.3)
|
81
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
-
rspec-support (~> 3.12.0)
|
83
|
-
rspec-mocks (3.12.6)
|
84
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
-
rspec-support (~> 3.12.0)
|
86
|
-
rspec-support (3.12.1)
|
87
|
-
rubocop (1.59.0)
|
88
|
-
json (~> 2.3)
|
89
|
-
language_server-protocol (>= 3.17.0)
|
90
|
-
parallel (~> 1.10)
|
91
|
-
parser (>= 3.2.2.4)
|
92
|
-
rainbow (>= 2.2.2, < 4.0)
|
93
|
-
regexp_parser (>= 1.8, < 3.0)
|
94
|
-
rexml (>= 3.2.5, < 4.0)
|
95
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
96
|
-
ruby-progressbar (~> 1.7)
|
97
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
98
|
-
rubocop-ast (1.30.0)
|
99
|
-
parser (>= 3.2.1.0)
|
100
|
-
rubocop-capybara (2.20.0)
|
101
|
-
rubocop (~> 1.41)
|
102
|
-
rubocop-factory_bot (2.25.1)
|
103
|
-
rubocop (~> 1.41)
|
104
|
-
rubocop-rake (0.6.0)
|
105
|
-
rubocop (~> 1.0)
|
106
|
-
rubocop-rspec (2.26.1)
|
107
|
-
rubocop (~> 1.40)
|
108
|
-
rubocop-capybara (~> 2.17)
|
109
|
-
rubocop-factory_bot (~> 2.22)
|
110
|
-
ruby-progressbar (1.13.0)
|
111
|
-
ruby2_keywords (0.0.5)
|
112
|
-
sevencop (0.35.1)
|
113
|
-
activesupport
|
114
|
-
rubocop
|
115
|
-
smart_properties (1.17.0)
|
116
|
-
tzinfo (2.0.6)
|
117
|
-
concurrent-ruby (~> 1.0)
|
118
|
-
unicode-display_width (2.5.0)
|
119
|
-
|
120
|
-
PLATFORMS
|
121
|
-
x86_64-linux
|
122
|
-
|
123
|
-
DEPENDENCIES
|
124
|
-
better_html (< 2.1)
|
125
|
-
nokogiri (~> 1.15.0)
|
126
|
-
rake
|
127
|
-
rspec
|
128
|
-
rubocop-erb!
|
129
|
-
rubocop-rake
|
130
|
-
rubocop-rspec
|
131
|
-
sevencop
|
132
|
-
|
133
|
-
BUNDLED WITH
|
134
|
-
2.3.19
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubocop'
|
4
|
-
|
5
|
-
module RuboCop
|
6
|
-
module Erb
|
7
|
-
# Merge default RuboCop config with plugin config.
|
8
|
-
class ConfigLoader
|
9
|
-
PLUGIN_CONFIG_PATH = ::File.expand_path(
|
10
|
-
'../../../config/default.yml',
|
11
|
-
__dir__
|
12
|
-
)
|
13
|
-
|
14
|
-
class << self
|
15
|
-
# @return [RuboCop::Config]
|
16
|
-
def call
|
17
|
-
new.call
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [RuboCop::Config]
|
22
|
-
def call
|
23
|
-
RuboCop::ConfigLoader.merge_with_default(
|
24
|
-
plugin_config,
|
25
|
-
PLUGIN_CONFIG_PATH
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
# @return [RuboCop::Config]
|
32
|
-
def plugin_config
|
33
|
-
config = ::RuboCop::Config.new(
|
34
|
-
plugin_config_hash,
|
35
|
-
PLUGIN_CONFIG_PATH
|
36
|
-
)
|
37
|
-
config.make_excludes_absolute
|
38
|
-
config
|
39
|
-
end
|
40
|
-
|
41
|
-
# @return [Hash]
|
42
|
-
def plugin_config_hash
|
43
|
-
::RuboCop::ConfigLoader.send(
|
44
|
-
:load_yaml_configuration,
|
45
|
-
PLUGIN_CONFIG_PATH
|
46
|
-
)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|