rubocop-erb 0.4.1 → 0.5.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: c57699be856b07c099f05fb62bdb69d656e008af86319f739c5e35a902628f84
4
- data.tar.gz: 5094efa6732c052e82eb56a44c3547dc52af06594b5a7cc648f63d4bcd39ac8e
3
+ metadata.gz: b13699d8ba0b6d66de391094e0bbfcc7a4476cfcd821e584b1c75c7d016324c5
4
+ data.tar.gz: bfab6b295f44a2e98e74b4a35ad82217ccf14cf212943b9c9dd4c2d978df3531
5
5
  SHA512:
6
- metadata.gz: bf57a7afa7c9990b85dc9028d0bf0353c076cd8cf37702e329d6d1bbe911d34f557d48d5ce324c8400f3679e6bdcd85c27977a01d7a61567d4b0bdfcd753c26e
7
- data.tar.gz: a9307f9f21a006152684219c01a4d683df8259eb155872c2dbf96be15d995a60924238b71648d0bda6987f01450ff5189177b5f4d5bbfaa2b8617b4a5959f92e
6
+ metadata.gz: d11d09706fd7d59ef07600ce2c3986ba90b436272465c19ed3dc60e1a87344540396d7b739d2f64afce8d6e486cc4de6a276e47eabf6251695d22f43df0a6fb3
7
+ data.tar.gz: f3153518ca9634939f6327e8881aa958012d20d1805ecb677a66909424d27add955bdb50c4f128d8b350184a153b5ac60657e838ff745cb679e7d3f68a77e971
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-erb (0.4.1)
4
+ rubocop-erb (0.5.1)
5
5
  better_html
6
6
  rubocop (~> 1.45)
7
7
 
data/config/default.yml CHANGED
@@ -23,6 +23,10 @@ Layout/ClosingParenthesisIndentation:
23
23
  Exclude:
24
24
  - '**/*.erb'
25
25
 
26
+ Layout/CommentIndentation:
27
+ Exclude:
28
+ - '**/*.erb'
29
+
26
30
  Layout/InitialIndentation:
27
31
  Exclude:
28
32
  - '**/*.erb'
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec path: '..'
6
6
 
7
+ gem 'better_html', '< 2.1' # 2.1 dropped ruby 2.7 support.
7
8
  gem 'nokogiri', '~> 1.15.0'
8
9
  gem 'rake'
9
10
  gem 'rspec'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-erb (0.4.1)
4
+ rubocop-erb (0.5.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.1.1)
29
+ better_html (2.0.2)
30
30
  actionview (>= 6.0)
31
31
  activesupport (>= 6.0)
32
32
  ast (~> 2.0)
@@ -49,9 +49,11 @@ GEM
49
49
  loofah (2.22.0)
50
50
  crass (~> 1.0.2)
51
51
  nokogiri (>= 1.12.0)
52
+ mini_portile2 (2.8.7)
52
53
  minitest (5.20.0)
53
54
  mutex_m (0.2.0)
54
- nokogiri (1.15.5-x86_64-linux)
55
+ nokogiri (1.15.5)
56
+ mini_portile2 (~> 2.8.2)
55
57
  racc (~> 1.4)
56
58
  parallel (1.24.0)
57
59
  parser (3.3.0.2)
@@ -119,6 +121,7 @@ PLATFORMS
119
121
  x86_64-linux
120
122
 
121
123
  DEPENDENCIES
124
+ better_html (< 2.1)
122
125
  nokogiri (~> 1.15.0)
123
126
  rake
124
127
  rspec
@@ -151,6 +151,7 @@ module RuboCop
151
151
  [ \t]*
152
152
  (?:\|[^|]*\|)?
153
153
  \s*
154
+ (\#.*)?
154
155
  \z
155
156
  /x.freeze
156
157
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Erb
5
- VERSION = '0.4.1'
5
+ VERSION = '0.5.1'
6
6
  end
7
7
  end
@@ -30,10 +30,17 @@ module RuboCop
30
30
  match_data = @ruby_clip.code.match(REGEXP)
31
31
  if match_data
32
32
  offset = match_data[0].length
33
- parse("[#{@ruby_clip.code[offset..]}]").children.map do |child|
33
+ condition = @ruby_clip.code[offset..].sub(/[ \t]then(?:[ \t].*)?/, '')
34
+ parse(
35
+ <<~RUBY
36
+ [
37
+ #{condition}
38
+ ]
39
+ RUBY
40
+ ).children.map do |child|
34
41
  RubyClip.new(
35
42
  code: child.location.expression.source,
36
- offset: @ruby_clip.offset + offset + child.location.expression.begin_pos - 1
43
+ offset: @ruby_clip.offset + offset + child.location.expression.begin_pos - 4
37
44
  )
38
45
  end
39
46
  else
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.4.1
4
+ version: 0.5.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-07-16 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_html