haml_lint 0.22.0 → 0.22.1
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/cli.rb +1 -5
- data/lib/haml_lint/options.rb +6 -1
- data/lib/haml_lint/reporter/hash_reporter.rb +7 -0
- data/lib/haml_lint/reporter/json_reporter.rb +9 -0
- data/lib/haml_lint/reporter.rb +25 -0
- data/lib/haml_lint/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74bd3e8d2dca346948dee6f5f3518cf8f4427bcf
|
4
|
+
data.tar.gz: 26f4cf58f23e0a19f480a0d3df8693f28663d709
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e9472a1c06a1ae244499ce15226afa4afcc17024dfe7951461194365e5f3ea4733f2c50310d701f676f2666703bc1753495e24a6fda4024d0452d0bd1d14282
|
7
|
+
data.tar.gz: b29a2894391ca05d84919f22899cf4853297b0048acab726c70217dc4941bd62d49e2e118b5dfd420b9e9cd8fc23d68f65dcd118530ec05613bd8383ced1828d
|
data/lib/haml_lint/cli.rb
CHANGED
@@ -111,11 +111,7 @@ module HamlLint
|
|
111
111
|
def print_available_reporters
|
112
112
|
log.info 'Available reporters:'
|
113
113
|
|
114
|
-
|
115
|
-
reporter.name.split('::').last.sub(/Reporter$/, '').downcase
|
116
|
-
end
|
117
|
-
|
118
|
-
reporter_names.sort.each do |reporter_name|
|
114
|
+
HamlLint::Reporter.available.map(&:cli_name).sort.each do |reporter_name|
|
119
115
|
log.log " - #{reporter_name}"
|
120
116
|
end
|
121
117
|
end
|
data/lib/haml_lint/options.rb
CHANGED
@@ -14,6 +14,7 @@ module HamlLint
|
|
14
14
|
parser.banner = "Usage: #{APP_NAME} [options] [file1, file2, ...]"
|
15
15
|
|
16
16
|
add_linter_options parser
|
17
|
+
add_report_options parser
|
17
18
|
add_file_options parser
|
18
19
|
add_logger_options parser
|
19
20
|
add_info_options parser
|
@@ -41,9 +42,13 @@ module HamlLint
|
|
41
42
|
"Specify which linters you don't want to run") do |linters|
|
42
43
|
@options[:excluded_linters] = linters
|
43
44
|
end
|
45
|
+
end
|
44
46
|
|
47
|
+
def add_report_options(parser)
|
48
|
+
reporters = HamlLint::Reporter.available.map(&:cli_name).sort
|
45
49
|
parser.on('-r', '--reporter reporter', String,
|
46
|
-
'Specify which reporter you want to use to generate the output
|
50
|
+
'Specify which reporter you want to use to generate the output. One of:',
|
51
|
+
*reporters.map { |name| " - #{name}" }) do |reporter|
|
47
52
|
@options[:reporter] = load_reporter_class(reporter.capitalize)
|
48
53
|
end
|
49
54
|
|
@@ -1,6 +1,13 @@
|
|
1
1
|
module HamlLint
|
2
2
|
# Outputs report as a Ruby Hash for easy use by other tools.
|
3
3
|
class Reporter::HashReporter < Reporter
|
4
|
+
# Disables this reporter on the CLI since it doesn't output anything.
|
5
|
+
#
|
6
|
+
# @return [false]
|
7
|
+
def self.available?
|
8
|
+
false
|
9
|
+
end
|
10
|
+
|
4
11
|
def display_report(report)
|
5
12
|
lints = report.lints
|
6
13
|
grouped = lints.group_by(&:filename)
|
@@ -1,6 +1,15 @@
|
|
1
|
+
require 'haml_lint/reporter/hash_reporter'
|
2
|
+
|
1
3
|
module HamlLint
|
2
4
|
# Outputs report as a JSON document.
|
3
5
|
class Reporter::JsonReporter < Reporter::HashReporter
|
6
|
+
# Ensures that the CLI is able to use the the reporter.
|
7
|
+
#
|
8
|
+
# @return [true]
|
9
|
+
def self.available?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
4
13
|
def display_report(report)
|
5
14
|
log.log super.to_json
|
6
15
|
end
|
data/lib/haml_lint/reporter.rb
CHANGED
@@ -8,6 +8,31 @@ module HamlLint
|
|
8
8
|
class Reporter
|
9
9
|
include Reporter::Hooks
|
10
10
|
|
11
|
+
# The CLI names of all configured reporters.
|
12
|
+
#
|
13
|
+
# @return [Array<String>]
|
14
|
+
def self.available
|
15
|
+
descendants.flat_map do |reporter|
|
16
|
+
available = reporter.available
|
17
|
+
available.unshift(reporter) if reporter.available?
|
18
|
+
available
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# A flag for whether to show the reporter on the command line.
|
23
|
+
#
|
24
|
+
# @return [Boolean]
|
25
|
+
def self.available?
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
# The name of the reporter as passed from the CLI.
|
30
|
+
#
|
31
|
+
# @return [String]
|
32
|
+
def self.cli_name
|
33
|
+
name.split('::').last.sub(/Reporter$/, '').downcase
|
34
|
+
end
|
35
|
+
|
11
36
|
# Creates the reporter that will display the given report.
|
12
37
|
#
|
13
38
|
# @param logger [HamlLint::Logger]
|
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.22.
|
4
|
+
version: 0.22.1
|
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: 2017-03-
|
12
|
+
date: 2017-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|