haml_lint 0.19.0 → 0.20.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7636e69c61d23c04c8398619c24288620f15881d
|
4
|
+
data.tar.gz: 73c113c20a5f3369791efb9ff5db4e54e4ebd852
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa7801c662223e5e38f88d8dcd3b8d083ce67ccc68c2cab14de2d1031389a9af0f254e470e3c96ea7e315b619e819b21ef5e54879947dc0f843c81731c140abd
|
7
|
+
data.tar.gz: a12121c2349a5a77a0aa1f7d821baeaee82b9b18a5e67bd935c73c4f9e7ba4b19aff9f0818f1b5a0ab1bfe2855b34ab69c6f0ca82cd68ded4444c65a2961aaa9
|
@@ -9,11 +9,17 @@ module HamlLint
|
|
9
9
|
# ...over:
|
10
10
|
#
|
11
11
|
# %tag{ class: 'class-name' }
|
12
|
+
#
|
13
|
+
# But will allow invalid class names for templating:
|
14
|
+
#
|
15
|
+
# %tag{ class: '{{ template-var }}' }
|
12
16
|
class Linter::ClassAttributeWithStaticValue < Linter
|
13
17
|
include LinterRegistry
|
14
18
|
|
15
19
|
STATIC_TYPES = [:str, :sym].freeze
|
16
20
|
|
21
|
+
VALID_CLASS_REGEX = /^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$/
|
22
|
+
|
17
23
|
def visit_tag(node)
|
18
24
|
return unless contains_class_attribute?(node.dynamic_attributes_sources)
|
19
25
|
|
@@ -41,7 +47,8 @@ module HamlLint
|
|
41
47
|
|
42
48
|
STATIC_TYPES.include?(key.type) &&
|
43
49
|
key.children.first.to_sym == :class &&
|
44
|
-
STATIC_TYPES.include?(value.type)
|
50
|
+
STATIC_TYPES.include?(value.type) &&
|
51
|
+
value.children.first =~ VALID_CLASS_REGEX
|
45
52
|
end
|
46
53
|
end
|
47
54
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubocop'
|
2
|
-
require 'rubocop/
|
2
|
+
require 'rubocop/ast/builder'
|
3
3
|
require 'parser/current'
|
4
4
|
|
5
5
|
module HamlLint
|
@@ -12,7 +12,7 @@ module HamlLint
|
|
12
12
|
class RubyParser
|
13
13
|
# Creates a reusable parser.
|
14
14
|
def initialize
|
15
|
-
@builder = ::RuboCop::
|
15
|
+
@builder = ::RuboCop::AST::Builder.new
|
16
16
|
@parser = ::Parser::CurrentRuby.new(@builder)
|
17
17
|
end
|
18
18
|
|
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.
|
4
|
+
version: 0.20.0
|
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:
|
12
|
+
date: 2017-01-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|
@@ -51,14 +51,14 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.47.0
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.47.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: sysexits
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|