haml_lint 0.16.2 → 0.17.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: 09f4e89dbdf8cff5d12bd8dd62eca4c2f6189f7a
4
- data.tar.gz: f941c7d6cd1d3bbb0c5e3602c7e1edd4d23881d7
3
+ metadata.gz: d93f7cd6e9bb819c5aa1489a1a50038b94eabfcf
4
+ data.tar.gz: 6322de21af3c48dca8a814ecf792e7ee253189c8
5
5
  SHA512:
6
- metadata.gz: 150b1597d322f8fff6fa25f6b615cb1ca1012a222f03b13592f43c2682bf99ccbd2b5e41c05149a56d3477d44de32b21b2291cbc174389a3b7fe524dde4ac028
7
- data.tar.gz: e1536df0d216348dafd1b345ca1a0c7b870d79ef2ea847ef72c5056637bd44cea4940b6552d03aaed74c21f6437c816bfd641fabd69ce9661133639c07c571a0
6
+ metadata.gz: 13705eeece8458ac110e747ed57f7ffcc10797452e89058b99d769bc573d5b06642c1fdaa38ecc54927570beadb597e31815409ad531fc34eab59594db4ac3b3
7
+ data.tar.gz: ac318973597c7ae52e6b0cbc80896588ec30c891edb0250f7920e82600b42542f126df175fb412e94a2be4fa7628fc985342ce27716472240d0cb85b5916ee3c
data/config/default.yml CHANGED
@@ -24,6 +24,9 @@ linters:
24
24
  enabled: true
25
25
  max_consecutive: 2
26
26
 
27
+ EmptyObjectReference:
28
+ enabled: true
29
+
27
30
  EmptyScript:
28
31
  enabled: true
29
32
 
@@ -0,0 +1,13 @@
1
+ module HamlLint
2
+ # Checks for empty object references (e.g. `%div[]`).
3
+ class Linter::EmptyObjectReference < Linter
4
+ include LinterRegistry
5
+
6
+ def visit_tag(node)
7
+ return unless node.object_reference? &&
8
+ node.object_reference_source.strip.empty?
9
+
10
+ record_lint(node, 'Empty object reference should be removed')
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ module HamlLint
2
+ # Outputs report as an XML checkstyle document.
3
+ class Reporter::CheckstyleReporter < Reporter
4
+ def display_report(report)
5
+ lints = report.lints
6
+ files = lints.group_by(&:filename)
7
+
8
+ xml = '<?xml version="1.0" encoding="utf-8"?>'
9
+
10
+ xml << '<checkstyle version="5.7">'
11
+
12
+ files.each do |filename, offenses|
13
+ xml << "<file name=\"#{filename}\">"
14
+ xml << render_offenses(offenses)
15
+ xml << '</file>'
16
+ end
17
+
18
+ xml << '</checkstyle>'
19
+ log.log xml
20
+ end
21
+
22
+ private
23
+
24
+ def render_offenses(offenses)
25
+ xml = ''
26
+ offenses.each do |offense|
27
+ xml << "<error line=\"#{offense.line}\" severity=\"#{offense.severity}\" "
28
+ xml << "message=\"#{offense.message}\" source=\"#{offense.linter.name}\" />"
29
+ end
30
+ xml
31
+ end
32
+ end
33
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module HamlLint
5
- VERSION = '0.16.2'.freeze
5
+ VERSION = '0.17.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.16.2
4
+ version: 0.17.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-03-15 00:00:00.000000000 Z
12
+ date: 2016-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml
@@ -29,16 +29,22 @@ dependencies:
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '10.0'
34
+ version: '10'
35
+ - - "<"
36
+ - !ruby/object:Gem::Version
37
+ version: '12'
35
38
  type: :runtime
36
39
  prerelease: false
37
40
  version_requirements: !ruby/object:Gem::Requirement
38
41
  requirements:
39
- - - "~>"
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '10'
45
+ - - "<"
40
46
  - !ruby/object:Gem::Version
41
- version: '10.0'
47
+ version: '12'
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: rubocop
44
50
  requirement: !ruby/object:Gem::Requirement
@@ -67,34 +73,6 @@ dependencies:
67
73
  - - "~>"
68
74
  - !ruby/object:Gem::Version
69
75
  version: '1.1'
70
- - !ruby/object:Gem::Dependency
71
- name: rspec
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '3.0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '3.0'
84
- - !ruby/object:Gem::Dependency
85
- name: rspec-its
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
89
- - !ruby/object:Gem::Version
90
- version: '1.0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '1.0'
98
76
  description: Configurable tool for writing clean and consistent HAML
99
77
  email:
100
78
  - eng@brigade.com
@@ -122,6 +100,7 @@ files:
122
100
  - lib/haml_lint/linter/classes_before_ids.rb
123
101
  - lib/haml_lint/linter/consecutive_comments.rb
124
102
  - lib/haml_lint/linter/consecutive_silent_scripts.rb
103
+ - lib/haml_lint/linter/empty_object_reference.rb
125
104
  - lib/haml_lint/linter/empty_script.rb
126
105
  - lib/haml_lint/linter/final_newline.rb
127
106
  - lib/haml_lint/linter/html_attributes.rb
@@ -148,6 +127,7 @@ files:
148
127
  - lib/haml_lint/rake_task.rb
149
128
  - lib/haml_lint/report.rb
150
129
  - lib/haml_lint/reporter.rb
130
+ - lib/haml_lint/reporter/checkstyle_reporter.rb
151
131
  - lib/haml_lint/reporter/default_reporter.rb
152
132
  - lib/haml_lint/reporter/json_reporter.rb
153
133
  - lib/haml_lint/ruby_extractor.rb