erb_lint 0.0.25 → 0.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/erb_lint/linters/space_around_erb_tag.rb +4 -2
- data/lib/erb_lint/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82be0f658ce3baab1198821bebab48ed006b10be
|
4
|
+
data.tar.gz: b7362a45f4b3a1c33f2fcc5be16c147fce73e04d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb77c4fb3259e5bf91f6881cd573c328959c79c931ac5e8b1a589050a74d8b3167e651df93d40340f2080532f1121d65eddf4d6d8ef481a93d92e61d744e76d8
|
7
|
+
data.tar.gz: efabfee67363da1cd91591d7acd37098c06ae51da74e1d12a653e0d02965c82c5b996b839f2ba3c823830b7063ea6ee512ed16c73b6c063f3a98639f9f90f646
|
@@ -13,14 +13,16 @@ module ERBLint
|
|
13
13
|
|
14
14
|
def run(processed_source)
|
15
15
|
processed_source.ast.descendants(:erb).each do |erb_node|
|
16
|
-
|
16
|
+
indicator_node, ltrim, code_node, rtrim = *erb_node
|
17
|
+
indicator = indicator_node&.loc&.source
|
18
|
+
next if indicator == '#' || indicator == '%'
|
17
19
|
code = code_node.children.first
|
18
20
|
|
19
21
|
start_spaces = code.match(START_SPACES)&.captures&.first || ""
|
20
22
|
if start_spaces.size != 1 && !start_spaces.include?("\n")
|
21
23
|
add_offense(
|
22
24
|
code_node.loc.resize(start_spaces.size),
|
23
|
-
"Use 1 space after `<%#{indicator
|
25
|
+
"Use 1 space after `<%#{indicator}#{ltrim&.loc&.source}` "\
|
24
26
|
"instead of #{start_spaces.size} space#{'s' if start_spaces.size > 1}.",
|
25
27
|
' '
|
26
28
|
)
|
data/lib/erb_lint/version.rb
CHANGED