haml_lint 0.19.0 → 0.20.0

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: 6f9747b3780af3cd9cdb42bcbd834821c1a1e767
4
- data.tar.gz: ecf2a62331f883e6bdfb799972ec0715e61e4147
3
+ metadata.gz: 7636e69c61d23c04c8398619c24288620f15881d
4
+ data.tar.gz: 73c113c20a5f3369791efb9ff5db4e54e4ebd852
5
5
  SHA512:
6
- metadata.gz: d79c9732f90c7492f22948ee1e9f7e8fa069fdb52fa3f4257d2775e6f84e1638299be68b12f6c5d3a21b0483ce93ad0f973b1734a0bdb812f36394597c0ced6b
7
- data.tar.gz: 0c12fd8b30090f23215c35811942b90ffc399cccea4f531c36c9a51e95dfe2aaf8872cf9310b8bf8cee039101c231bde8ae91dcbfc51388aac9f2ccf31ce3b38
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/ast_node/builder'
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::Node::Builder.new
15
+ @builder = ::RuboCop::AST::Builder.new
16
16
  @parser = ::Parser::CurrentRuby.new(@builder)
17
17
  end
18
18
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module HamlLint
5
- VERSION = '0.19.0'.freeze
5
+ VERSION = '0.20.0'.freeze
6
6
  end
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.19.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: 2016-12-15 00:00:00.000000000 Z
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.36.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.36.0
61
+ version: 0.47.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: sysexits
64
64
  requirement: !ruby/object:Gem::Requirement