haml_lint 0.35.0 → 0.36.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/haml_lint/adapter.rb +1 -1
- data/lib/haml_lint/options.rb +4 -0
- data/lib/haml_lint/runner.rb +16 -1
- data/lib/haml_lint/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d2be98b8d977ca5ccbcb29baf2f0fd8d1b527d44b3a9929a55c538df46d5a82
|
4
|
+
data.tar.gz: 7b5a39a010d171a7487b90c4cf1be92ed9d62f6dc2c223fe5e81bb2e75652be8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16061fce86f6da8868f2f78b19b92e8184efb80e6f73fd2b0101359466c2123abea947e7cb3b1729b005ef6144ddac5604e7ac28a4646b04c3d213c6ceaf052f
|
7
|
+
data.tar.gz: a355b4893f8a7ada12d66ab61b25150a032b2cdfb5f69a9f3dfbf71f2b338bd946ed164e6b614a2dc6e647be5785d3268353f82a30f31b9efa5d4d4c90b6b356
|
data/lib/haml_lint/adapter.rb
CHANGED
@@ -19,7 +19,7 @@ module HamlLint
|
|
19
19
|
version = haml_version
|
20
20
|
case version
|
21
21
|
when '~> 4.0' then HamlLint::Adapter::Haml4
|
22
|
-
when '~> 5.0', '~> 5.1' then HamlLint::Adapter::Haml5
|
22
|
+
when '~> 5.0', '~> 5.1', '~> 5.2' then HamlLint::Adapter::Haml5
|
23
23
|
else fail HamlLint::Exceptions::UnknownHamlVersion, "Cannot handle Haml version: #{version}"
|
24
24
|
end
|
25
25
|
end
|
data/lib/haml_lint/options.rb
CHANGED
@@ -51,6 +51,10 @@ module HamlLint
|
|
51
51
|
"Specify which linters you don't want to run") do |linters|
|
52
52
|
@options[:excluded_linters] = linters
|
53
53
|
end
|
54
|
+
|
55
|
+
parser.on('-p', '--parallel', 'Run linters in parallel using available CPUs') do
|
56
|
+
@options[:parallel] = true
|
57
|
+
end
|
54
58
|
end
|
55
59
|
|
56
60
|
def add_report_options(parser)
|
data/lib/haml_lint/runner.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'parallel'
|
4
|
+
|
3
5
|
module HamlLint
|
4
6
|
# Responsible for running the applicable linters against the desired files.
|
5
7
|
class Runner
|
@@ -21,6 +23,7 @@ module HamlLint
|
|
21
23
|
@files = extract_applicable_files(config, options)
|
22
24
|
@linter_selector = HamlLint::LinterSelector.new(config, options)
|
23
25
|
@fail_fast = options.fetch(:fail_fast, false)
|
26
|
+
@cache = {}
|
24
27
|
|
25
28
|
report(options)
|
26
29
|
end
|
@@ -121,7 +124,7 @@ module HamlLint
|
|
121
124
|
# @param report [HamlLint::Report]
|
122
125
|
# @return [void]
|
123
126
|
def process_file(file, report)
|
124
|
-
lints = collect_lints(file, linter_selector, config)
|
127
|
+
lints = @cache[file] || collect_lints(file, linter_selector, config)
|
125
128
|
lints.each { |lint| report.add_lint(lint) }
|
126
129
|
report.finish_file(file, lints)
|
127
130
|
end
|
@@ -134,8 +137,20 @@ module HamlLint
|
|
134
137
|
def report(options)
|
135
138
|
report = HamlLint::Report.new(reporter: options[:reporter], fail_level: options[:fail_level])
|
136
139
|
report.start(@files)
|
140
|
+
warm_cache if options[:parallel]
|
137
141
|
process_files(report)
|
138
142
|
report
|
139
143
|
end
|
144
|
+
|
145
|
+
# Cache the result of processing lints in parallel.
|
146
|
+
#
|
147
|
+
# @return [void]
|
148
|
+
def warm_cache
|
149
|
+
results = Parallel.map(files) do |file|
|
150
|
+
lints = collect_lints(file, linter_selector, config)
|
151
|
+
[file, lints]
|
152
|
+
end
|
153
|
+
@cache = results.to_h
|
154
|
+
end
|
140
155
|
end
|
141
156
|
end
|
data/lib/haml_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.36.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.3'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,21 @@ dependencies:
|
|
29
29
|
version: '4.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.3'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: parallel
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.10'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.10'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: rainbow
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|