rubocop-erb 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +16 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +6 -2
- data/lib/rubocop/erb/{ruby_clipper.rb → keyword_remover.rb} +3 -3
- data/lib/rubocop/erb/ruby_extractor.rb +6 -6
- data/lib/rubocop/erb/version.rb +2 -2
- data/lib/rubocop/erb.rb +1 -1
- data/rubocop-erb.gemspec +1 -1
- metadata +8 -9
- data/lib/rubocop-erb.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df7883aaaa8cb83f5661b9edfcf74f12b6dc84bb89d135c518e7f78c6dee9068
|
4
|
+
data.tar.gz: 5f8686b18e1f199663fdf3b8efa455e765e2d5f6800a6e4d8366610212eb25a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 915462fa70d43cf062f9970c8ad0fa85f2f4249f26a0618204f8e5ff472e63ac934732c40ab87ddf5a49ceebf1b70b91b55a7cacf1aed0413370cede971eedaa
|
7
|
+
data.tar.gz: c669c6a2849482d58abe45de7012b324cfe8b68cefc7b551e64013d135013ac579017f40c4ef0d865c947b9f8cb91d96c04c63426bd1e83b500cf4bc942d8c91
|
data/.rubocop.yml
CHANGED
@@ -2,6 +2,7 @@ require:
|
|
2
2
|
- rubocop-erb
|
3
3
|
- rubocop-rake
|
4
4
|
- rubocop-rspec
|
5
|
+
- sevencop
|
5
6
|
|
6
7
|
inherit_mode:
|
7
8
|
merge:
|
@@ -19,10 +20,6 @@ Gemspec/RequireMFA:
|
|
19
20
|
Metrics:
|
20
21
|
Enabled: false
|
21
22
|
|
22
|
-
Naming/FileName:
|
23
|
-
Exclude:
|
24
|
-
- lib/rubocop-erb.rb
|
25
|
-
|
26
23
|
RSpec/ExampleLength:
|
27
24
|
Enabled: false
|
28
25
|
|
@@ -32,6 +29,21 @@ RSpec/MultipleExpectations:
|
|
32
29
|
RSpec/NamedSubject:
|
33
30
|
Enabled: false
|
34
31
|
|
32
|
+
Sevencop/AutoloadOrdered:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
Sevencop/HashElementOrdered:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
Sevencop/MethodDefinitionArgumentsMultiline:
|
39
|
+
Enabled: true
|
40
|
+
|
41
|
+
Sevencop/MethodDefinitionKeywordArgumentOrdered:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
Sevencop/MethodDefinitionOrdered:
|
45
|
+
Enabled: true
|
46
|
+
|
35
47
|
Style/Documentation:
|
36
48
|
Enabled: false
|
37
49
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-erb (0.2.
|
4
|
+
rubocop-erb (0.2.3)
|
5
5
|
better_html
|
6
6
|
rubocop (~> 1.45)
|
7
7
|
|
@@ -39,7 +39,7 @@ GEM
|
|
39
39
|
crass (~> 1.0.2)
|
40
40
|
nokogiri (>= 1.5.9)
|
41
41
|
minitest (5.17.0)
|
42
|
-
nokogiri (1.14.
|
42
|
+
nokogiri (1.14.2-x86_64-linux)
|
43
43
|
racc (~> 1.4)
|
44
44
|
parallel (1.22.1)
|
45
45
|
parser (3.2.0.0)
|
@@ -87,6 +87,9 @@ GEM
|
|
87
87
|
rubocop (~> 1.33)
|
88
88
|
rubocop-capybara (~> 2.17)
|
89
89
|
ruby-progressbar (1.11.0)
|
90
|
+
sevencop (0.33.0)
|
91
|
+
activesupport
|
92
|
+
rubocop
|
90
93
|
smart_properties (1.17.0)
|
91
94
|
tzinfo (2.0.6)
|
92
95
|
concurrent-ruby (~> 1.0)
|
@@ -101,6 +104,7 @@ DEPENDENCIES
|
|
101
104
|
rubocop-erb!
|
102
105
|
rubocop-rake
|
103
106
|
rubocop-rspec
|
107
|
+
sevencop
|
104
108
|
|
105
109
|
BUNDLED WITH
|
106
110
|
2.3.19
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module RuboCop
|
4
4
|
module Erb
|
5
|
-
# Remove unnecessary part (e.g. `if`, `unless`, `do`, ...) from Ruby-ish code.
|
6
|
-
class
|
5
|
+
# Remove unnecessary keyword part (e.g. `if`, `unless`, `do`, ...) from Ruby-ish code.
|
6
|
+
class KeywordRemover
|
7
7
|
class << self
|
8
8
|
# @param [RuboCop::Erb::RubyClip] ruby_clip
|
9
9
|
# @return [RuboCop::Erb::RubyClip]
|
@@ -51,7 +51,7 @@ module RuboCop
|
|
51
51
|
| while
|
52
52
|
| for[ \t]+\w+[ \t]+in
|
53
53
|
)
|
54
|
-
[ \t]
|
54
|
+
\b[ \t]*
|
55
55
|
/x.freeze
|
56
56
|
|
57
57
|
class << self
|
@@ -49,6 +49,11 @@ module RuboCop
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
# @return [String, nil]
|
53
|
+
def file_path
|
54
|
+
@processed_source.path
|
55
|
+
end
|
56
|
+
|
52
57
|
# @return [Enumerator<BetterHtml::AST::Node>]
|
53
58
|
def nodes
|
54
59
|
erbs.flat_map do |erb|
|
@@ -77,17 +82,12 @@ module RuboCop
|
|
77
82
|
end.flat_map do |ruby_clip|
|
78
83
|
WhenDecomposer.call(ruby_clip)
|
79
84
|
end.map do |ruby_clip|
|
80
|
-
|
85
|
+
KeywordRemover.call(ruby_clip)
|
81
86
|
end.reject do |ruby_clip|
|
82
87
|
ruby_clip.code.match?(/\A\s*\z/)
|
83
88
|
end
|
84
89
|
end
|
85
90
|
|
86
|
-
# @return [String, nil]
|
87
|
-
def file_path
|
88
|
-
@processed_source.path
|
89
|
-
end
|
90
|
-
|
91
91
|
# @return [Boolean]
|
92
92
|
def supported_file_path_pattern?
|
93
93
|
file_path&.end_with?('.erb')
|
data/lib/rubocop/erb/version.rb
CHANGED
data/lib/rubocop/erb.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Erb
|
5
5
|
autoload :ConfigLoader, 'rubocop/erb/config_loader'
|
6
|
+
autoload :KeywordRemover, 'rubocop/erb/keyword_remover'
|
6
7
|
autoload :RubyClip, 'rubocop/erb/ruby_clip'
|
7
|
-
autoload :RubyClipper, 'rubocop/erb/ruby_clipper'
|
8
8
|
autoload :RubyExtractor, 'rubocop/erb/ruby_extractor'
|
9
9
|
autoload :WhenDecomposer, 'rubocop/erb/when_decomposer'
|
10
10
|
end
|
data/rubocop-erb.gemspec
CHANGED
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.2.
|
4
|
+
version: 0.2.3
|
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: 2023-02-
|
11
|
+
date: 2023-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: better_html
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.45'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- r7kamura@gmail.com
|
44
44
|
executables: []
|
@@ -54,12 +54,11 @@ files:
|
|
54
54
|
- README.md
|
55
55
|
- Rakefile
|
56
56
|
- config/default.yml
|
57
|
-
- lib/rubocop-erb.rb
|
58
57
|
- lib/rubocop/erb.rb
|
59
58
|
- lib/rubocop/erb/config_loader.rb
|
59
|
+
- lib/rubocop/erb/keyword_remover.rb
|
60
60
|
- lib/rubocop/erb/rubocop_extension.rb
|
61
61
|
- lib/rubocop/erb/ruby_clip.rb
|
62
|
-
- lib/rubocop/erb/ruby_clipper.rb
|
63
62
|
- lib/rubocop/erb/ruby_extractor.rb
|
64
63
|
- lib/rubocop/erb/version.rb
|
65
64
|
- lib/rubocop/erb/when_decomposer.rb
|
@@ -71,7 +70,7 @@ metadata:
|
|
71
70
|
homepage_uri: https://github.com/r7kamura/rubocop-erb
|
72
71
|
source_code_uri: https://github.com/r7kamura/rubocop-erb
|
73
72
|
changelog_uri: https://github.com/r7kamura/rubocop-erb/releases
|
74
|
-
post_install_message:
|
73
|
+
post_install_message:
|
75
74
|
rdoc_options: []
|
76
75
|
require_paths:
|
77
76
|
- lib
|
@@ -86,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
85
|
- !ruby/object:Gem::Version
|
87
86
|
version: '0'
|
88
87
|
requirements: []
|
89
|
-
rubygems_version: 3.3.
|
90
|
-
signing_key:
|
88
|
+
rubygems_version: 3.3.26
|
89
|
+
signing_key:
|
91
90
|
specification_version: 4
|
92
91
|
summary: RuboCop plugin for ERB template.
|
93
92
|
test_files: []
|
data/lib/rubocop-erb.rb
DELETED