erb_lint 0.0.32 → 0.0.37

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: 31efb24d1c4403b9325a23da3fcabce1be3e5cad7cf2f802c707911f966cfd16
4
- data.tar.gz: 9a6a612f87175d77212f84c4062973ea7d6ceaf0a7c2b9dca9debe10020fd524
3
+ metadata.gz: 20ce12719e17ebfc24ca522965e85985fe665c0cbec1d9751320b1a779ec8c9c
4
+ data.tar.gz: 536222d32134c71f72083c5083f575e8422024f8f5e26e0daf9b9eadd181d3e9
5
5
  SHA512:
6
- metadata.gz: b5fa4f3cb3051d6a30ffe2c9ff87770b40b224a5fb8dd000201846a613b42519a00e6a795082bc2dd055ef9e7aa88e92cecd7c365ca189bdbec6e9a41da32531
7
- data.tar.gz: e9683a5db2457f4460a2eaed0e1c005dc98c33295ef554d77edf081e47503a4059537da75367ed5db31396a71547d8f0bf87c24f64c996ffc7c6b5c1f5fb6703
6
+ metadata.gz: 44f138dfdfff77b04d03f293f3b48f90744bbf3fcbcfeadc1cf3b5f0d47cae5c933b18b0e7273d64cdf549170e2a2aa33c5110cbc0aa62c84855e6e29a5f67ae
7
+ data.tar.gz: 1fe70e0ddb97e0930b2645b0942d5ed08e74c5b40a41af1b6b9c7b9219b4be136495a5f3a0991363e8877aaef7bab5da2eb1f4162dc85f64b2f17d6ae2ca1184
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'rubocop'
4
+
3
5
  require 'erb_lint/corrector'
4
6
  require 'erb_lint/file_loader'
5
7
  require 'erb_lint/linter_config'
@@ -10,8 +12,15 @@ require 'erb_lint/processed_source'
10
12
  require 'erb_lint/runner_config'
11
13
  require 'erb_lint/runner'
12
14
  require 'erb_lint/version'
15
+ require 'erb_lint/stats'
16
+ require 'erb_lint/reporter'
13
17
 
14
18
  # Load linters
15
19
  Dir[File.expand_path('erb_lint/linters/**/*.rb', File.dirname(__FILE__))].each do |file|
16
20
  require file
17
21
  end
22
+
23
+ # Load reporters
24
+ Dir[File.expand_path('erb_lint/reporters/**/*.rb', File.dirname(__FILE__))].each do |file|
25
+ require file
26
+ end
@@ -14,16 +14,8 @@ module ERBLint
14
14
  DEFAULT_LINT_ALL_GLOB = "**/*.html{+*,}.erb"
15
15
 
16
16
  class ExitWithFailure < RuntimeError; end
17
- class ExitWithSuccess < RuntimeError; end
18
17
 
19
- class Stats
20
- attr_accessor :found, :corrected, :exceptions
21
- def initialize
22
- @found = 0
23
- @corrected = 0
24
- @exceptions = 0
25
- end
26
- end
18
+ class ExitWithSuccess < RuntimeError; end
27
19
 
28
20
  def initialize
29
21
  @options = {}
@@ -51,9 +43,12 @@ module ERBLint
51
43
  failure!('no linter available with current configuration')
52
44
  end
53
45
 
54
- puts "Linting #{lint_files.size} files with "\
55
- "#{enabled_linter_classes.size} #{'autocorrectable ' if autocorrect?}linters..."
56
- puts
46
+ @options[:format] ||= :multiline
47
+ @stats.files = lint_files.size
48
+ @stats.linters = enabled_linter_classes.size
49
+
50
+ reporter = Reporter.create_reporter(@options[:format], @stats, autocorrect?)
51
+ reporter.preview
57
52
 
58
53
  runner = ERBLint::Runner.new(file_loader, @config)
59
54
 
@@ -72,20 +67,7 @@ module ERBLint
72
67
  end
73
68
  end
74
69
 
75
- if @stats.corrected > 0
76
- corrected_found_diff = @stats.found - @stats.corrected
77
- if corrected_found_diff > 0
78
- warn(Rainbow(
79
- "#{@stats.corrected} error(s) corrected and #{corrected_found_diff} error(s) remaining in ERB files"
80
- ).red)
81
- else
82
- puts Rainbow("#{@stats.corrected} error(s) corrected in ERB files").green
83
- end
84
- elsif @stats.found > 0
85
- warn(Rainbow("#{@stats.found} error(s) were found in ERB files").red)
86
- else
87
- puts Rainbow("No errors were found in ERB files").green
88
- end
70
+ reporter.show
89
71
 
90
72
  @stats.found == 0 && @stats.exceptions == 0
91
73
  rescue OptionParser::InvalidOption, OptionParser::InvalidArgument, ExitWithFailure => e
@@ -126,15 +108,12 @@ module ERBLint
126
108
  file_content = corrector.corrected_content
127
109
  runner.clear_offenses
128
110
  end
111
+ offenses_filename = relative_filename(filename)
112
+ offenses = runner.offenses || []
129
113
 
130
- @stats.found += runner.offenses.size
131
- runner.offenses.each do |offense|
132
- puts <<~EOF
133
- #{offense.message}#{Rainbow(' (not autocorrected)').red if autocorrect?}
134
- In file: #{relative_filename(filename)}:#{offense.line_range.begin}
135
-
136
- EOF
137
- end
114
+ @stats.found += offenses.size
115
+ @stats.processed_files[offenses_filename] ||= []
116
+ @stats.processed_files[offenses_filename] |= offenses
138
117
  end
139
118
 
140
119
  def correct(processed_source, offenses)
@@ -258,6 +237,15 @@ module ERBLint
258
237
  end
259
238
  end
260
239
 
240
+ opts.on("--format FORMAT", format_options_help) do |format|
241
+ unless Reporter.available_format?(format)
242
+ error_message = invalid_format_error_message(format)
243
+ failure!(error_message)
244
+ end
245
+
246
+ @options[:format] = format
247
+ end
248
+
261
249
  opts.on("--lint-all", "Lint all files matching configured glob [default: #{DEFAULT_LINT_ALL_GLOB}]") do |config|
262
250
  @options[:lint_all] = config
263
251
  end
@@ -289,5 +277,15 @@ module ERBLint
289
277
  end
290
278
  end
291
279
  end
280
+
281
+ def format_options_help
282
+ "Report offenses in the given format: "\
283
+ "(#{Reporter.available_formats.join(', ')}) (default: multiline)"
284
+ end
285
+
286
+ def invalid_format_error_message(given_format)
287
+ formats = Reporter.available_formats.map { |format| " - #{format}\n" }
288
+ "#{given_format}: is not a valid format. Available formats:\n#{formats.join}"
289
+ end
292
290
  end
293
291
  end
@@ -17,11 +17,22 @@ module ERBLint
17
17
  end
18
18
 
19
19
  def corrector
20
- RuboCop::Cop::Corrector.new(@processed_source.source_buffer, corrections)
20
+ BASE.new(@processed_source.source_buffer, corrections)
21
21
  end
22
22
 
23
- def diagnostics
24
- corrector.diagnostics
23
+ if ::RuboCop::Version::STRING.to_f >= 0.87
24
+ require 'rubocop/cop/legacy/corrector'
25
+ BASE = ::RuboCop::Cop::Legacy::Corrector
26
+
27
+ def diagnostics
28
+ []
29
+ end
30
+ else
31
+ BASE = ::RuboCop::Cop::Corrector
32
+
33
+ def diagnostics
34
+ corrector.diagnostics
35
+ end
25
36
  end
26
37
  end
27
38
  end
@@ -9,8 +9,14 @@ module ERBLint
9
9
  @base_path = base_path
10
10
  end
11
11
 
12
- def yaml(filename)
13
- YAML.safe_load(read_content(filename), [Regexp, Symbol], [], false, filename) || {}
12
+ if RUBY_VERSION >= "2.6"
13
+ def yaml(filename)
14
+ YAML.safe_load(read_content(filename), permitted_classes: [Regexp, Symbol], filename: filename) || {}
15
+ end
16
+ else
17
+ def yaml(filename)
18
+ YAML.safe_load(read_content(filename), [Regexp, Symbol], [], false, filename) || {}
19
+ end
14
20
  end
15
21
 
16
22
  private
@@ -14,6 +14,7 @@ module ERBLint
14
14
  # `ERBLint::Linters::Foo.simple_name` #=> "Foo"
15
15
  # `ERBLint::Linters::Compass::Bar.simple_name` #=> "Compass::Bar"
16
16
  def inherited(linter)
17
+ super
17
18
  linter.simple_name = if linter.name.start_with?('ERBLint::Linters::')
18
19
  name_parts = linter.name.split('::')
19
20
  name_parts[2..-1].join('::')
@@ -4,19 +4,28 @@ module ERBLint
4
4
  # Stores all linters available to the application.
5
5
  module LinterRegistry
6
6
  CUSTOM_LINTERS_DIR = '.erb-linters'
7
- @linters = []
7
+ @loaded_linters = []
8
8
 
9
9
  class << self
10
- attr_reader :linters
10
+ def clear
11
+ @linters = nil
12
+ end
11
13
 
12
14
  def included(linter_class)
13
- @linters << linter_class
15
+ @loaded_linters << linter_class
14
16
  end
15
17
 
16
18
  def find_by_name(name)
17
19
  linters.detect { |linter| linter.simple_name == name }
18
20
  end
19
21
 
22
+ def linters
23
+ @linters ||= begin
24
+ load_custom_linters
25
+ @loaded_linters
26
+ end
27
+ end
28
+
20
29
  def load_custom_linters(directory = CUSTOM_LINTERS_DIR)
21
30
  ruby_files = Dir.glob(File.expand_path(File.join(directory, '**', '*.rb')))
22
31
  ruby_files.each { |file| require file }
@@ -63,7 +63,7 @@ module ERBLint
63
63
  string = offense.source_range.source
64
64
  return unless (klass = load_corrector)
65
65
  return unless string.strip.length > 1
66
- node = RuboCop::AST::StrNode.new(:str, [string])
66
+ node = ::RuboCop::AST::StrNode.new(:str, [string])
67
67
  corrector = klass.new(node, processed_source.filename, corrector_i18n_load_path, offense.source_range)
68
68
  corrector.autocorrect(tag_start: '<%= ', tag_end: ' %>')
69
69
  rescue MissingCorrector, MissingI18nLoadPath
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'better_html'
3
4
  require 'better_html/ast/node'
4
5
  require 'better_html/test_helper/ruby_node'
5
6
  require 'erb_lint/utils/block_map'
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'better_html'
4
- require 'rubocop'
5
4
  require 'tempfile'
6
5
  require 'erb_lint/utils/offset_corrector'
7
6
 
@@ -26,7 +25,7 @@ module ERBLint
26
25
  super
27
26
  @only_cops = @config.only
28
27
  custom_config = config_from_hash(@config.rubocop_config)
29
- @rubocop_config = RuboCop::ConfigLoader.merge_with_default(custom_config, '')
28
+ @rubocop_config = ::RuboCop::ConfigLoader.merge_with_default(custom_config, '')
30
29
  end
31
30
 
32
31
  def run(processed_source)
@@ -35,17 +34,29 @@ module ERBLint
35
34
  end
36
35
  end
37
36
 
38
- def autocorrect(processed_source, offense)
39
- return unless offense.context
40
-
41
- lambda do |corrector|
42
- passthrough = Utils::OffsetCorrector.new(
43
- processed_source,
44
- corrector,
45
- offense.context[:offset],
46
- offense.context[:bound_range],
47
- )
48
- offense.context[:rubocop_correction].call(passthrough)
37
+ if ::RuboCop::Version::STRING.to_f >= 0.87
38
+ def autocorrect(_processed_source, offense)
39
+ return unless offense.context
40
+ rubocop_correction = offense.context[:rubocop_correction]
41
+ return unless rubocop_correction
42
+
43
+ lambda do |corrector|
44
+ corrector.import!(rubocop_correction, offset: offense.context[:offset])
45
+ end
46
+ end
47
+ else
48
+ def autocorrect(processed_source, offense)
49
+ return unless offense.context
50
+
51
+ lambda do |corrector|
52
+ passthrough = Utils::OffsetCorrector.new(
53
+ processed_source,
54
+ corrector,
55
+ offense.context[:offset],
56
+ offense.context[:bound_range],
57
+ )
58
+ offense.context[:rubocop_correction].call(passthrough)
59
+ end
49
60
  end
50
61
  end
51
62
 
@@ -62,22 +73,23 @@ module ERBLint
62
73
  original_source = code_node.loc.source
63
74
  trimmed_source = original_source.sub(BLOCK_EXPR, '').sub(SUFFIX_EXPR, '')
64
75
  alignment_column = code_node.loc.column
76
+ offset = code_node.loc.begin_pos - alignment_column
65
77
  aligned_source = "#{' ' * alignment_column}#{trimmed_source}"
66
78
 
67
79
  source = rubocop_processed_source(aligned_source, processed_source.filename)
68
80
  return unless source.valid_syntax?
69
81
 
70
- team = build_team
71
- team.inspect_file(source)
72
- team.cops.each do |cop|
73
- correction_offset = 0
74
- cop.offenses.reject(&:disabled?).each do |rubocop_offense|
75
- if rubocop_offense.corrected?
76
- correction = cop.corrections[correction_offset]
77
- correction_offset += 1
78
- end
82
+ activate_team(processed_source, source, offset, code_node, build_team)
83
+ end
84
+
85
+ if ::RuboCop::Version::STRING.to_f >= 0.87
86
+ def activate_team(processed_source, source, offset, code_node, team)
87
+ report = team.investigate(source)
88
+ report.offenses.each do |rubocop_offense|
89
+ next if rubocop_offense.disabled?
90
+
91
+ correction = rubocop_offense.corrector if rubocop_offense.corrected?
79
92
 
80
- offset = code_node.loc.begin_pos - alignment_column
81
93
  offense_range = processed_source
82
94
  .to_source_range(rubocop_offense.location)
83
95
  .offset(offset)
@@ -85,6 +97,25 @@ module ERBLint
85
97
  add_offense(rubocop_offense, offense_range, correction, offset, code_node.loc.range)
86
98
  end
87
99
  end
100
+ else
101
+ def activate_team(processed_source, source, offset, code_node, team)
102
+ team.inspect_file(source)
103
+ team.cops.each do |cop|
104
+ correction_offset = 0
105
+ cop.offenses.reject(&:disabled?).each do |rubocop_offense|
106
+ if rubocop_offense.corrected?
107
+ correction = cop.corrections[correction_offset]
108
+ correction_offset += 1
109
+ end
110
+
111
+ offense_range = processed_source
112
+ .to_source_range(rubocop_offense.location)
113
+ .offset(offset)
114
+
115
+ add_offense(rubocop_offense, offense_range, correction, offset, code_node.loc.range)
116
+ end
117
+ end
118
+ end
88
119
  end
89
120
 
90
121
  def tempfile_from(filename, content)
@@ -97,7 +128,7 @@ module ERBLint
97
128
  end
98
129
 
99
130
  def rubocop_processed_source(content, filename)
100
- RuboCop::ProcessedSource.new(
131
+ ::RuboCop::ProcessedSource.new(
101
132
  content,
102
133
  @rubocop_config.target_ruby_version,
103
134
  filename
@@ -106,15 +137,15 @@ module ERBLint
106
137
 
107
138
  def cop_classes
108
139
  if @only_cops.present?
109
- selected_cops = RuboCop::Cop::Cop.all.select { |cop| cop.match?(@only_cops) }
110
- RuboCop::Cop::Registry.new(selected_cops)
140
+ selected_cops = ::RuboCop::Cop::Cop.all.select { |cop| cop.match?(@only_cops) }
141
+ ::RuboCop::Cop::Registry.new(selected_cops)
111
142
  else
112
- RuboCop::Cop::Registry.new(RuboCop::Cop::Cop.all)
143
+ ::RuboCop::Cop::Registry.new(::RuboCop::Cop::Cop.all)
113
144
  end
114
145
  end
115
146
 
116
147
  def build_team
117
- RuboCop::Cop::Team.new(
148
+ ::RuboCop::Cop::Team.new(
118
149
  cop_classes,
119
150
  @rubocop_config,
120
151
  extra_details: true,
@@ -129,7 +160,7 @@ module ERBLint
129
160
  resolve_inheritance(hash, inherit_from)
130
161
 
131
162
  tempfile_from('.erblint-rubocop', hash.to_yaml) do |tempfile|
132
- RuboCop::ConfigLoader.load_file(tempfile.path)
163
+ ::RuboCop::ConfigLoader.load_file(tempfile.path)
133
164
  end
134
165
  end
135
166
 
@@ -137,7 +168,7 @@ module ERBLint
137
168
  base_configs(inherit_from)
138
169
  .reverse_each do |base_config|
139
170
  base_config.each do |k, v|
140
- hash[k] = hash.key?(k) ? RuboCop::ConfigLoader.merge(v, hash[k]) : v if v.is_a?(Hash)
171
+ hash[k] = hash.key?(k) ? ::RuboCop::ConfigLoader.merge(v, hash[k]) : v if v.is_a?(Hash)
141
172
  end
142
173
  end
143
174
  end
@@ -146,7 +177,7 @@ module ERBLint
146
177
  regex = URI::DEFAULT_PARSER.make_regexp(%w(http https))
147
178
  configs = Array(inherit_from).compact.map do |base_name|
148
179
  if base_name =~ /\A#{regex}\z/
149
- RuboCop::ConfigLoader.load_file(RuboCop::RemoteConfig.new(base_name, Dir.pwd))
180
+ ::RuboCop::ConfigLoader.load_file(::RuboCop::RemoteConfig.new(base_name, Dir.pwd))
150
181
  else
151
182
  config_from_hash(@file_loader.yaml(base_name))
152
183
  end
@@ -28,9 +28,9 @@ module ERBLint
28
28
  end
29
29
 
30
30
  def cop_classes
31
- selected_cops = RuboCop::Cop::Cop.all.select { |cop| cop.match?(@only_cops) }
31
+ selected_cops = ::RuboCop::Cop::Cop.all.select { |cop| cop.match?(@only_cops) }
32
32
 
33
- RuboCop::Cop::Registry.new(selected_cops)
33
+ ::RuboCop::Cop::Registry.new(selected_cops)
34
34
  end
35
35
  end
36
36
  end
@@ -31,5 +31,13 @@ module ERBLint
31
31
  def line_range
32
32
  Range.new(source_range.line, source_range.last_line)
33
33
  end
34
+
35
+ def line_number
36
+ line_range.begin
37
+ end
38
+
39
+ def column
40
+ source_range.column
41
+ end
34
42
  end
35
43
  end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+ require 'active_support/core_ext/class'
3
+ require 'active_support/core_ext/module/delegation'
4
+
5
+ module ERBLint
6
+ class Reporter
7
+ def self.create_reporter(format, *args)
8
+ reporter_klass = "#{ERBLint::Reporters}::#{format.to_s.camelize}Reporter".constantize
9
+ reporter_klass.new(*args)
10
+ end
11
+
12
+ def self.available_format?(format)
13
+ available_formats.include?(format.to_s)
14
+ end
15
+
16
+ def self.available_formats
17
+ descendants
18
+ .map(&:to_s)
19
+ .map(&:demodulize)
20
+ .map(&:underscore)
21
+ .map { |klass_name| klass_name.sub("_reporter", "") }
22
+ .sort
23
+ end
24
+
25
+ def initialize(stats, autocorrect)
26
+ @stats = stats
27
+ @autocorrect = autocorrect
28
+ end
29
+
30
+ def preview; end
31
+
32
+ def show; end
33
+
34
+ private
35
+
36
+ attr_reader :stats, :autocorrect
37
+ delegate :processed_files, to: :stats
38
+ end
39
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ERBLint
4
+ module Reporters
5
+ class CompactReporter < Reporter
6
+ def preview
7
+ puts "Linting #{stats.files} files with "\
8
+ "#{stats.linters} #{'autocorrectable ' if autocorrect}linters..."
9
+ end
10
+
11
+ def show
12
+ processed_files.each do |filename, offenses|
13
+ offenses.each do |offense|
14
+ puts format_offense(filename, offense)
15
+ end
16
+ end
17
+
18
+ footer
19
+ summary
20
+ end
21
+
22
+ private
23
+
24
+ def format_offense(filename, offense)
25
+ [
26
+ "#{filename}:",
27
+ "#{offense.line_number}:",
28
+ "#{offense.column}: ",
29
+ offense.message.to_s,
30
+ ].join
31
+ end
32
+
33
+ def footer; end
34
+
35
+ def summary
36
+ if stats.corrected > 0
37
+ report_corrected_offenses
38
+ elsif stats.found > 0
39
+ warn(Rainbow("#{stats.found} error(s) were found in ERB files").red)
40
+ else
41
+ puts Rainbow("No errors were found in ERB files").green
42
+ end
43
+ end
44
+
45
+ def report_corrected_offenses
46
+ corrected_found_diff = stats.found - stats.corrected
47
+
48
+ if corrected_found_diff > 0
49
+ message = Rainbow(
50
+ "#{stats.corrected} error(s) corrected and #{corrected_found_diff} error(s) remaining in ERB files"
51
+ ).red
52
+
53
+ warn(message)
54
+ else
55
+ puts Rainbow("#{stats.corrected} error(s) corrected in ERB files").green
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ require_relative "compact_reporter"
3
+
4
+ module ERBLint
5
+ module Reporters
6
+ class MultilineReporter < CompactReporter
7
+ private
8
+
9
+ def format_offense(filename, offense)
10
+ <<~EOF
11
+
12
+ #{offense.message}#{Rainbow(' (not autocorrected)').red if autocorrect}
13
+ In file: #{filename}:#{offense.line_number}
14
+ EOF
15
+ end
16
+
17
+ def footer
18
+ puts
19
+ end
20
+ end
21
+ end
22
+ end
@@ -10,7 +10,6 @@ module ERBLint
10
10
  @config = config || RunnerConfig.default
11
11
  raise ArgumentError, 'expect `config` to be a RunnerConfig instance' unless @config.is_a?(RunnerConfig)
12
12
 
13
- LinterRegistry.load_custom_linters
14
13
  linter_classes = LinterRegistry.linters.select { |klass| @config.for_linter(klass).enabled? }
15
14
  @linters = linter_classes.map do |linter_class|
16
15
  linter_class.new(@file_loader, @config.for_linter(linter_class))
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ module ERBLint
3
+ class Stats
4
+ attr_accessor :found,
5
+ :corrected,
6
+ :exceptions,
7
+ :linters,
8
+ :files,
9
+ :processed_files
10
+
11
+ def initialize(
12
+ found: 0,
13
+ corrected: 0,
14
+ exceptions: 0,
15
+ linters: 0,
16
+ files: 0,
17
+ processed_files: {}
18
+ )
19
+ @found = found
20
+ @corrected = corrected
21
+ @exceptions = exceptions
22
+ @linters = linters
23
+ @files = files
24
+ @processed_files = processed_files
25
+ end
26
+ end
27
+ end
@@ -38,7 +38,9 @@ module ERBLint
38
38
  @corrector.remove_trailing(range_with_offset(range), size)
39
39
  end
40
40
 
41
- def range_with_offset(range)
41
+ def range_with_offset(node_or_range)
42
+ range = to_range(node_or_range)
43
+
42
44
  @processed_source.to_source_range(
43
45
  bound(@offset + range.begin_pos)..bound(@offset + (range.end_pos - 1))
44
46
  )
@@ -50,6 +52,21 @@ module ERBLint
50
52
  @bound_range.max,
51
53
  ].min
52
54
  end
55
+
56
+ private
57
+
58
+ def to_range(node_or_range)
59
+ case node_or_range
60
+ when ::RuboCop::AST::Node, ::Parser::Source::Comment
61
+ node_or_range.loc.expression
62
+ when ::Parser::Source::Range
63
+ node_or_range
64
+ else
65
+ raise TypeError,
66
+ 'Expected a Parser::Source::Range, Comment or ' \
67
+ "Rubocop::AST::Node, got #{node_or_range.class}"
68
+ end
69
+ end
53
70
  end
54
71
  end
55
72
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ERBLint
4
- VERSION = '0.0.32'
4
+ VERSION = '0.0.37'
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.32
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Chan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-07 00:00:00.000000000 Z
11
+ date: 2021-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_html
@@ -42,16 +42,30 @@ dependencies:
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.79'
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: parser
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.7.1.4
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: '0.79'
68
+ version: 2.7.1.4
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: activesupport
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +136,20 @@ dependencies:
122
136
  - - ">="
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-shopify
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
125
153
  description: ERB Linter tool.
126
154
  email:
127
155
  - justin.the.c@gmail.com
@@ -157,9 +185,13 @@ files:
157
185
  - lib/erb_lint/linters/trailing_whitespace.rb
158
186
  - lib/erb_lint/offense.rb
159
187
  - lib/erb_lint/processed_source.rb
188
+ - lib/erb_lint/reporter.rb
189
+ - lib/erb_lint/reporters/compact_reporter.rb
190
+ - lib/erb_lint/reporters/multiline_reporter.rb
160
191
  - lib/erb_lint/runner.rb
161
192
  - lib/erb_lint/runner_config.rb
162
193
  - lib/erb_lint/runner_config_resolver.rb
194
+ - lib/erb_lint/stats.rb
163
195
  - lib/erb_lint/utils/block_map.rb
164
196
  - lib/erb_lint/utils/offset_corrector.rb
165
197
  - lib/erb_lint/utils/ruby_to_erb.rb
@@ -177,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
209
  requirements:
178
210
  - - ">="
179
211
  - !ruby/object:Gem::Version
180
- version: 2.4.0
212
+ version: 2.5.0
181
213
  required_rubygems_version: !ruby/object:Gem::Requirement
182
214
  requirements:
183
215
  - - ">="