rubocop-erb 0.2.1 → 0.2.2

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: 9a314d2115fff57bc77a2fa817590a4678e6d87a3f003956a928e57b9cd42b5b
4
- data.tar.gz: 51e9a745d150b3c3c99a4294f0cf1f4f14be871ecf44b415087c411f7c54e33d
3
+ metadata.gz: 99ed46b9d8eba4e69cea7d354412e033b02648eace4dfd38d9bcd59f83e0943d
4
+ data.tar.gz: bb8f0f0aeae48270f3c2ea4a7a90da7b2ebc5f51c85c7df2e9f2dda039fd6f1e
5
5
  SHA512:
6
- metadata.gz: d39cc8a0b4a91a7e29b2a68434dd19f02e41f31ebb31ad5c5027593e588e8677e452de6e8b3f40dca654dad03b9eb5f34db3e09af87508d94be8d54a569f0c0e
7
- data.tar.gz: 45789da936d92b4a212f5160af6ea49f770a07b8ec1a398c60364c2b0e27465a4868ea44d177e775c81010642b51322b6ce9242053cbf250dada6abe489583ff
6
+ metadata.gz: 8aa2e1476e145e3174417b20baef489ada2b253fcfcf5bdb0e2ad80463e192588a7180c9a643b1eccf9d85a3b8a6828cc23b5372b4e5928856855a7cec744575
7
+ data.tar.gz: 8e5c7ecc7da0bbea9d862d5aac33ff89768de9b2d85365a560e4b799363d07636cd4d9cfb654ceb0794cf79c556cea3c685204ed3b118bc46c581e7debb53899
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
@@ -9,3 +9,4 @@ gem 'rake'
9
9
  gem 'rspec'
10
10
  gem 'rubocop-rake'
11
11
  gem 'rubocop-rspec'
12
+ gem 'sevencop'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-erb (0.2.1)
4
+ rubocop-erb (0.2.2)
5
5
  better_html
6
6
  rubocop (~> 1.45)
7
7
 
@@ -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 RubyClipper
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]
@@ -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
- RubyClipper.call(ruby_clip)
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')
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Rubocop
3
+ module RuboCop
4
4
  module Erb
5
- VERSION = '0.2.1'
5
+ VERSION = '0.2.2'
6
6
  end
7
7
  end
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
@@ -4,7 +4,7 @@ require_relative 'lib/rubocop/erb/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'rubocop-erb'
7
- spec.version = Rubocop::Erb::VERSION
7
+ spec.version = RuboCop::Erb::VERSION
8
8
  spec.authors = ['Ryo Nakamura']
9
9
  spec.email = ['r7kamura@gmail.com']
10
10
 
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.1
4
+ version: 0.2.2
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-09 00:00:00.000000000 Z
11
+ date: 2023-02-10 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.7
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
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubocop/erb'