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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b136922bb523d860a4167f2ee6a896c332bf083bbf88fcb30ea983cd28ad1ed5
4
- data.tar.gz: 145bd0a1217c31f9e4ccd7221548fef987910c4f026c221fb89fa65b8834d7d7
3
+ metadata.gz: 421010e9ed7767b1702afd3360fc90e3461ba2955a06d9757aa7377943b26d7e
4
+ data.tar.gz: a8d4558c8407297f5470a7f50aae478f295b370a2af76f86118b24637a417de2
5
5
  SHA512:
6
- metadata.gz: f3bba6099a1aaf0402d046d0f6acc0a7e17af7d0ca1a05883ae9b6016cf79d141f54976974e5a7035b60cb257f123434c49447c870fdda0a699d1ae62de158cb
7
- data.tar.gz: fdab81ad466f3407ca177f60fe727ed7c760c82448d5ba009722fc04175c89f28dc9b43875a90c4c75df600eef0607c7aa7fbdca1da85d1f262cf970cec9cab0
6
+ metadata.gz: c00c0b52e0da4421ad79a52981a47a7dc7c1d289ab7ecd2757a201dac54ed75ff09a4f1ec009e8c7c242635eb5f8231059e147bf4d7e62c46518f07ccff7c08a
7
+ data.tar.gz: 4ec4bf36b000df7e2118f147e02507fa82a9a033c5bb656f35719616ed023ac89eec9e5b26ffa1a67ae642cde47d061e0e657ae9237afd0a520ed0b799364786
@@ -39,9 +39,9 @@ module ERBLint
39
39
  load_config
40
40
 
41
41
  if !@files.empty? && lint_files.empty?
42
- success!("no files found...\n")
42
+ failure!("no files found...\n")
43
43
  elsif lint_files.empty?
44
- success!("no files given...\n#{option_parser}")
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
- if @options[:lint_all]
171
- pattern = File.expand_path(DEFAULT_LINT_ALL_GLOB, Dir.pwd)
172
- Dir[pattern].select { |filename| !excluded?(filename) }
173
- else
174
- @files
175
- .map { |f| Dir.exist?(f) ? Dir[File.join(f, DEFAULT_LINT_ALL_GLOB)] : f }
176
- .map { |f| f.include?('*') ? Dir[f] : f }
177
- .flatten
178
- .map { |f| File.expand_path(f, Dir.pwd) }
179
- .select { |filename| !excluded?(filename) }
180
- end
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 that can be corrected automatically (default: false)") do |config|
273
+ opts.on("-a", "--autocorrect", "Correct offenses automatically if possible (default: false)") do |config|
272
274
  @options[:autocorrect] = config
273
275
  end
274
276
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ERBLint
4
- VERSION = '0.0.30'
4
+ VERSION = '0.0.31'
5
5
  end
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.30
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: 2019-10-01 00:00:00.000000000 Z
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: '0.51'
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: '0.51'
54
+ version: 0.79.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement