haml_lint 0.15.0 → 0.15.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11dfd8283a78d7d9464e3a003a7f97446178b76f
|
4
|
+
data.tar.gz: de67f6e626da0bd9e3f91e1183af9d88af54d369
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd464c7c0f1542a93a3bf3fa1b017117ffef544dbc6b5c95cd05c7a2ff99ff78362786d23b024b3608596acc8cc165eb3e3791d659a3752e87f6aff7506d702c
|
7
|
+
data.tar.gz: 41b5410fc090a6151476edfdadc7d3f24eb7f2d0ed8e7d7065463901d382e412fc017694a6725532546095e08dc8b9eaa05274d30f99b93eb05786159e6465af
|
@@ -22,6 +22,8 @@ module HamlLint
|
|
22
22
|
# @raise [HamlLint::Exceptions::InvalidFilePath]
|
23
23
|
# @return [Array<String>] list of actual files
|
24
24
|
def find(patterns, excluded_patterns)
|
25
|
+
excluded_patterns = excluded_patterns.map { |pattern| normalize_path(pattern) }
|
26
|
+
|
25
27
|
extract_files_from(patterns).reject do |file|
|
26
28
|
excluded_patterns.any? do |exclusion_glob|
|
27
29
|
HamlLint::Utils.any_glob_matches?(exclusion_glob, file)
|
@@ -62,7 +64,15 @@ module HamlLint
|
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
|
-
files.uniq.sort
|
67
|
+
files.uniq.sort.map { |file| normalize_path(file) }
|
68
|
+
end
|
69
|
+
|
70
|
+
# Trim "./" from the front of relative paths.
|
71
|
+
#
|
72
|
+
# @param path [String]
|
73
|
+
# @return [String]
|
74
|
+
def normalize_path(path)
|
75
|
+
path.start_with?(".#{File::SEPARATOR}") ? path[2..-1] : path
|
66
76
|
end
|
67
77
|
|
68
78
|
# Whether the given file should be treated as a Haml file.
|
@@ -14,13 +14,14 @@ module HamlLint
|
|
14
14
|
visit_children(node) if descend == :children
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
send(method, node, &block) if respond_to?(method, true)
|
17
|
+
safe_send("visit_#{node_name(node)}", node, &block)
|
19
18
|
|
20
19
|
# Visit all children by default unless the block was invoked (indicating
|
21
20
|
# the user intends to not recurse further, or wanted full control over
|
22
21
|
# when the children were visited).
|
23
22
|
visit_children(node) unless block_called
|
23
|
+
|
24
|
+
safe_send("after_visit_#{node_name(node)}", node, &block)
|
24
25
|
end
|
25
26
|
|
26
27
|
def visit_children(parent)
|
@@ -32,5 +33,9 @@ module HamlLint
|
|
32
33
|
def node_name(node)
|
33
34
|
node.type
|
34
35
|
end
|
36
|
+
|
37
|
+
def safe_send(name, *args, &block)
|
38
|
+
send(name, *args, &block) if respond_to?(name, true)
|
39
|
+
end
|
35
40
|
end
|
36
41
|
end
|
@@ -13,7 +13,7 @@ module HamlLint
|
|
13
13
|
},
|
14
14
|
'space' => {
|
15
15
|
start_regex: /\A\{ [^ ]/,
|
16
|
-
end_regex:
|
16
|
+
end_regex: /[^ ] \}\z/,
|
17
17
|
start_message: 'Hash attribute should start with one space after the opening brace',
|
18
18
|
end_message: 'Hash attribute should end with one space before the closing brace'
|
19
19
|
}
|
@@ -84,6 +84,11 @@ module HamlLint
|
|
84
84
|
add_line(code, node) unless code.empty?
|
85
85
|
end
|
86
86
|
|
87
|
+
def after_visit_tag(node)
|
88
|
+
# We add a dummy puts statement for closing tag.
|
89
|
+
add_line("puts # #{node.tag_name}/", node)
|
90
|
+
end
|
91
|
+
|
87
92
|
def visit_script(node)
|
88
93
|
code = node.text
|
89
94
|
add_line(code.strip, node)
|
@@ -164,7 +169,7 @@ module HamlLint
|
|
164
169
|
end
|
165
170
|
|
166
171
|
def anonymous_block?(text)
|
167
|
-
text =~ /\bdo\s*(\|\s*[^\|]*\s*\|)?\z/
|
172
|
+
text =~ /\bdo\s*(\|\s*[^\|]*\s*\|)?(\s*#.*)?\z/
|
168
173
|
end
|
169
174
|
|
170
175
|
START_BLOCK_KEYWORDS = %w[if unless case begin for until while]
|
data/lib/haml_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brigade Engineering
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
173
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.4.
|
174
|
+
rubygems_version: 2.4.8
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: HAML lint tool
|