erb_lint 0.0.30 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/erb_lint/cli.rb +20 -18
- data/lib/erb_lint/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 421010e9ed7767b1702afd3360fc90e3461ba2955a06d9757aa7377943b26d7e
|
4
|
+
data.tar.gz: a8d4558c8407297f5470a7f50aae478f295b370a2af76f86118b24637a417de2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c00c0b52e0da4421ad79a52981a47a7dc7c1d289ab7ecd2757a201dac54ed75ff09a4f1ec009e8c7c242635eb5f8231059e147bf4d7e62c46518f07ccff7c08a
|
7
|
+
data.tar.gz: 4ec4bf36b000df7e2118f147e02507fa82a9a033c5bb656f35719616ed023ac89eec9e5b26ffa1a67ae642cde47d061e0e657ae9237afd0a520ed0b799364786
|
data/lib/erb_lint/cli.rb
CHANGED
@@ -39,9 +39,9 @@ module ERBLint
|
|
39
39
|
load_config
|
40
40
|
|
41
41
|
if !@files.empty? && lint_files.empty?
|
42
|
-
|
42
|
+
failure!("no files found...\n")
|
43
43
|
elsif lint_files.empty?
|
44
|
-
|
44
|
+
failure!("no files found or given, specify files or config...\n#{option_parser}")
|
45
45
|
end
|
46
46
|
|
47
47
|
ensure_files_exist(lint_files)
|
@@ -54,9 +54,12 @@ module ERBLint
|
|
54
54
|
"#{enabled_linter_classes.size} #{'autocorrectable ' if autocorrect?}linters..."
|
55
55
|
puts
|
56
56
|
|
57
|
+
runner = ERBLint::Runner.new(file_loader, @config)
|
58
|
+
|
57
59
|
lint_files.each do |filename|
|
60
|
+
runner.clear_offenses
|
58
61
|
begin
|
59
|
-
run_with_corrections(filename)
|
62
|
+
run_with_corrections(runner, filename)
|
60
63
|
rescue => e
|
61
64
|
@stats.exceptions += 1
|
62
65
|
puts "Exception occured when processing: #{relative_filename(filename)}"
|
@@ -101,11 +104,9 @@ module ERBLint
|
|
101
104
|
@options[:autocorrect]
|
102
105
|
end
|
103
106
|
|
104
|
-
def run_with_corrections(filename)
|
107
|
+
def run_with_corrections(runner, filename)
|
105
108
|
file_content = File.read(filename, encoding: Encoding::UTF_8)
|
106
109
|
|
107
|
-
runner = ERBLint::Runner.new(file_loader, @config)
|
108
|
-
|
109
110
|
7.times do
|
110
111
|
processed_source = ERBLint::ProcessedSource.new(filename, file_content)
|
111
112
|
runner.run(processed_source)
|
@@ -167,17 +168,18 @@ module ERBLint
|
|
167
168
|
end
|
168
169
|
|
169
170
|
def lint_files
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
171
|
+
@lint_files ||=
|
172
|
+
if @options[:lint_all]
|
173
|
+
pattern = File.expand_path(DEFAULT_LINT_ALL_GLOB, Dir.pwd)
|
174
|
+
Dir[pattern].select { |filename| !excluded?(filename) }
|
175
|
+
else
|
176
|
+
@files
|
177
|
+
.map { |f| Dir.exist?(f) ? Dir[File.join(f, DEFAULT_LINT_ALL_GLOB)] : f }
|
178
|
+
.map { |f| f.include?('*') ? Dir[f] : f }
|
179
|
+
.flatten
|
180
|
+
.map { |f| File.expand_path(f, Dir.pwd) }
|
181
|
+
.select { |filename| !excluded?(filename) }
|
182
|
+
end
|
181
183
|
end
|
182
184
|
|
183
185
|
def excluded?(filename)
|
@@ -268,7 +270,7 @@ module ERBLint
|
|
268
270
|
@options[:enabled_linters] = linters
|
269
271
|
end
|
270
272
|
|
271
|
-
opts.on("--autocorrect", "Correct offenses
|
273
|
+
opts.on("-a", "--autocorrect", "Correct offenses automatically if possible (default: false)") do |config|
|
272
274
|
@options[:autocorrect] = config
|
273
275
|
end
|
274
276
|
|
data/lib/erb_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erb_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Chan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: better_html
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.79.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.79.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activesupport
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|