haml_lint 0.18.1 → 0.18.2

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: b362b9d5e1e225ffb9f878ae933a9446edaf4ed8
4
- data.tar.gz: bd841a48d2e152668650420e95cb4f4ca6a65b8c
3
+ metadata.gz: 1e62485b5a5cfd611b764d2e83560bc3e81b174f
4
+ data.tar.gz: 773e5beb63aa9c6759499fab2a7cedc9844d52a6
5
5
  SHA512:
6
- metadata.gz: 212c2c30d86a0cc25cc7621c011553015bde42e2f93d120e6bd456be5b70fdcef728a2009aa20bd2835c04a080ebba83d7da3415ef4ff8a5f88128bb00ebc52a
7
- data.tar.gz: 15b581bdc90f6a71fe63a2b7117d5cab05c4b683e34fadad3d831f1d20bd03ae059b34b17b5b61885872f6bd8f537e5d5d63bcf5cf17f4f9d1b243490a955c4c
6
+ metadata.gz: 1744cc9bb1276c04f5a35ed795eeb926802554d90c2a963d3315a7fef4877bca03c40a9ba7ac28f9dc02e17d7f678b6696daf6e90a0a5772d5e0b523faadc465
7
+ data.tar.gz: 08caf5fe8f62593e45bee7fd440236e2aa18f2457076f7a3a4714de3f3f681afe8a7271de32eba89677e30579906898ce6bcb86ef6781984d8ece86811e28751
@@ -7,7 +7,9 @@ module HamlLint
7
7
 
8
8
  MESSAGE_FORMAT = 'The %s symbol should have one space separating it from code'.freeze
9
9
 
10
- def visit_tag(node) # rubocop:disable Metrics/CyclomaticComplexity
10
+ ALLOWED_SEPARATORS = [' ', '#'].freeze
11
+
12
+ def visit_tag(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/LineLength, Metrics/PerceivedComplexity
11
13
  # If this tag has inline script
12
14
  return unless node.contains_script?
13
15
 
@@ -26,6 +28,8 @@ module HamlLint
26
28
  end
27
29
  end
28
30
 
31
+ return if tag_with_text[index] == '#' # Ignore code comments
32
+
29
33
  # Check if the character before the start of the script is a space
30
34
  # (need to do it this way as the parser strips whitespace from node)
31
35
  return unless tag_with_text[index - 1] != ' '
@@ -48,7 +52,7 @@ module HamlLint
48
52
 
49
53
  def missing_space?(node)
50
54
  text = node.script
51
- text[0] != ' ' if text
55
+ !ALLOWED_SEPARATORS.include?(text[0]) if text
52
56
  end
53
57
  end
54
58
  end
@@ -26,7 +26,8 @@ module HamlLint
26
26
  offenses.each do |offense|
27
27
  xml << "<error line=\"#{offense.line}\" severity=\"#{offense.severity}\" "
28
28
  xml << "message=\"#{CGI.escapeHTML offense.message}\" "
29
- xml << "source=\"#{offense.linter.name}\" />"
29
+ xml << "source=\"#{offense.linter.name}\" " if offense.linter
30
+ xml << '/>'
30
31
  end
31
32
  xml
32
33
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module HamlLint
5
- VERSION = '0.18.1'.freeze
5
+ VERSION = '0.18.2'.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.18.1
4
+ version: 0.18.2
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-07-19 00:00:00.000000000 Z
12
+ date: 2016-08-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml