haml_lint 0.61.1 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/haml_lint/linter/strict_locals.rb +14 -6
- data/lib/haml_lint/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3754327462146047a8677d8e91b7d47e3d538f2459f2d3ebd583ad2dafc92c3b
|
4
|
+
data.tar.gz: 33ccb58e67c32798c90da242cc8708e763f93a1509c6083d54b351453f587a5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a9ece6eda4dac35772948661486fc6c4fada9d3071b8b4ff52d37bab8930d032d0138a95f59a1a54c760951001010102317965e11aea2fd6dec4a35c7528aac
|
7
|
+
data.tar.gz: 67d13e3d045dd804f7f93c662dd8dfb833ac8104a2c52bd1699ba9201861630e686228de725ede55d469a9b3c15a02fcf0b910b843c3d425314e59721ae01ba0
|
@@ -14,12 +14,16 @@ module HamlLint
|
|
14
14
|
def visit_root(root)
|
15
15
|
return unless enabled?(root)
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
# Rails technically allows the comment to be anywhere in the file,
|
18
|
+
# but as a best practice they should be at the top of the file.
|
19
|
+
# https://guides.rubyonrails.org/action_view_overview.html#strict-locals
|
20
|
+
# https://github.com/rails/rails/blob/v8.0.2/actionview/lib/action_view/template.rb#L368
|
21
|
+
found =
|
22
|
+
root.children
|
23
|
+
.take_while { |child| child.is_a?(HamlLint::Tree::HamlCommentNode) }
|
24
|
+
.any?(&:is_strict_locals?)
|
20
25
|
|
21
|
-
|
22
|
-
return if first_child.disabled?(self)
|
26
|
+
return if found
|
23
27
|
|
24
28
|
record_lint(DummyNode.new(1), failure_message)
|
25
29
|
end
|
@@ -31,7 +35,11 @@ module HamlLint
|
|
31
35
|
# @api private
|
32
36
|
# @return [true, false]
|
33
37
|
def enabled?(root)
|
34
|
-
matcher.match(File.basename(root.file))
|
38
|
+
return false unless matcher.match(File.basename(root.file))
|
39
|
+
|
40
|
+
# This linter can also be disabled by a comment at the top of the file
|
41
|
+
first_child = root.children.first
|
42
|
+
first_child.nil? || !first_child.disabled?(self)
|
35
43
|
end
|
36
44
|
|
37
45
|
# The type of files the linter is configured to check.
|
data/lib/haml_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.62.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-04-08 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: haml
|