haml_lint 0.53.0 → 0.57.0
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/constants.rb +1 -1
- data/lib/haml_lint/directive.rb +2 -2
- data/lib/haml_lint/document.rb +10 -1
- data/lib/haml_lint/linter/alignment_tabs.rb +1 -1
- data/lib/haml_lint/linter/class_attribute_with_static_value.rb +1 -1
- data/lib/haml_lint/linter/indentation.rb +1 -1
- data/lib/haml_lint/linter/multiline_pipe.rb +1 -1
- data/lib/haml_lint/linter/no_placeholders.rb +2 -2
- data/lib/haml_lint/options.rb +8 -2
- data/lib/haml_lint/reporter/github_reporter.rb +32 -0
- data/lib/haml_lint/ruby_extraction/chunk_extractor.rb +15 -14
- data/lib/haml_lint/runner.rb +39 -29
- data/lib/haml_lint/source.rb +24 -0
- data/lib/haml_lint/spec/shared_rubocop_autocorrect_context.rb +33 -3
- data/lib/haml_lint/utils.rb +2 -1
- data/lib/haml_lint/version.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '092e548aae63e23d9c6a5c3c11087590219e52792459ee548a5802503e80f6ec'
|
4
|
+
data.tar.gz: 120a88fbfb5b78e5d08724dffc9c7cf22292e391633c780da94161295ea745e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5123d876bb4b79d4fbf14fae8acef295993c909baaee63975f899571fe450cf67f503c761b2628ddb96874f39a4be51a8c489ddb94a87eb95034e3a05ba44431
|
7
|
+
data.tar.gz: 152d02d1daa2f51e9c0ddca5602d74642b324e860daa33aeec715ff4e2be297054abaf0d35dd9d15cfafcf15955bfce48823575643b18c4375707f172621eb66
|
data/lib/haml_lint/constants.rb
CHANGED
data/lib/haml_lint/directive.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module HamlLint
|
4
4
|
# Handles linter configuration transformation via Haml comments.
|
5
5
|
class Directive
|
6
|
-
LINTER_REGEXP = /(?:[A-Z]\w+)
|
6
|
+
LINTER_REGEXP = /(?:[A-Z]\w+)/
|
7
7
|
|
8
8
|
DIRECTIVE_REGEXP = /
|
9
9
|
# "haml-lint:" with optional spacing
|
@@ -14,7 +14,7 @@ module HamlLint
|
|
14
14
|
|
15
15
|
# "all" or a comma-separated list (with optional spaces) of linters
|
16
16
|
(?<linters>all | (?:#{LINTER_REGEXP}\s*,\s*)* #{LINTER_REGEXP})
|
17
|
-
/x
|
17
|
+
/x
|
18
18
|
|
19
19
|
# Constructs a directive from source code as a given line.
|
20
20
|
#
|
data/lib/haml_lint/document.rb
CHANGED
@@ -14,6 +14,9 @@ module HamlLint
|
|
14
14
|
# @return [String] Haml template file path
|
15
15
|
attr_reader :file
|
16
16
|
|
17
|
+
# @return [Boolean] true if source changes (from autocorrect) should be written to stdout instead of disk
|
18
|
+
attr_reader :write_to_stdout
|
19
|
+
|
17
20
|
# @return [HamlLint::Tree::Node] Root of the parse tree
|
18
21
|
attr_reader :tree
|
19
22
|
|
@@ -36,10 +39,12 @@ module HamlLint
|
|
36
39
|
# @param source [String] Haml code to parse
|
37
40
|
# @param options [Hash]
|
38
41
|
# @option options :file [String] file name of document that was parsed
|
42
|
+
# @option options :write_to_stdout [Boolean] true if source changes should be written to stdout
|
39
43
|
# @raise [Haml::Parser::Error] if there was a problem parsing the document
|
40
44
|
def initialize(source, options)
|
41
45
|
@config = options[:config]
|
42
46
|
@file = options.fetch(:file, STRING_SOURCE)
|
47
|
+
@write_to_stdout = options[:write_to_stdout]
|
43
48
|
@source_was_changed = false
|
44
49
|
process_source(source)
|
45
50
|
end
|
@@ -82,7 +87,11 @@ module HamlLint
|
|
82
87
|
if file == STRING_SOURCE
|
83
88
|
raise HamlLint::Exceptions::InvalidFilePath, 'Cannot write without :file option'
|
84
89
|
end
|
85
|
-
|
90
|
+
if @write_to_stdout
|
91
|
+
$stdout << unstrip_frontmatter(source)
|
92
|
+
else
|
93
|
+
File.write(file, unstrip_frontmatter(source))
|
94
|
+
end
|
86
95
|
@source_was_changed = false
|
87
96
|
end
|
88
97
|
|
@@ -20,7 +20,7 @@ module HamlLint
|
|
20
20
|
|
21
21
|
STATIC_TYPES = %i[str sym].freeze
|
22
22
|
|
23
|
-
VALID_CLASS_REGEX = /^-?[_a-zA-Z]+[_a-zA-Z0-9-]
|
23
|
+
VALID_CLASS_REGEX = /^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$/
|
24
24
|
|
25
25
|
def visit_tag(node)
|
26
26
|
return unless contains_class_attribute?(node.dynamic_attributes_sources)
|
@@ -6,8 +6,8 @@ module HamlLint
|
|
6
6
|
include LinterRegistry
|
7
7
|
|
8
8
|
MSG = 'Placeholders attributes should not be used.'
|
9
|
-
HASH_REGEXP = /:?['"]?placeholder['"]?(?::| *=>)
|
10
|
-
HTML_REGEXP = /placeholder
|
9
|
+
HASH_REGEXP = /:?['"]?placeholder['"]?(?::| *=>)/
|
10
|
+
HTML_REGEXP = /placeholder=/
|
11
11
|
|
12
12
|
def visit_tag(node)
|
13
13
|
return unless node.hash_attributes_source =~ HASH_REGEXP || node.html_attributes_source =~ HTML_REGEXP
|
data/lib/haml_lint/options.rb
CHANGED
@@ -32,7 +32,7 @@ module HamlLint
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
-
def add_linter_options(parser) # rubocop:disable Metrics/MethodLength
|
35
|
+
def add_linter_options(parser) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
36
36
|
parser.on('--auto-gen-config', 'Generate a configuration file acting as a TODO list') do
|
37
37
|
@options[:auto_gen_config] = true
|
38
38
|
end
|
@@ -70,7 +70,13 @@ module HamlLint
|
|
70
70
|
@options[:autocorrect] ||= :safe
|
71
71
|
end
|
72
72
|
|
73
|
-
parser.on('--
|
73
|
+
parser.on('-s', '--stdin FILE', 'Pipe source from STDIN, using FILE in ' \
|
74
|
+
'offense when combined with --auto-correct and --stdin.') do |file_path|
|
75
|
+
@options[:stdin] = file_path
|
76
|
+
end
|
77
|
+
|
78
|
+
parser.on('--stderr', 'Write all output to stderr except for the autocorrected source. ' \
|
79
|
+
'This is especially useful when combined with --auto-correct and --stdin') do
|
74
80
|
@options[:stderr] = true
|
75
81
|
end
|
76
82
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
module HamlLint
|
4
|
+
# Outputs GitHub workflow commands for GitHub check annotations when run within GitHub actions.
|
5
|
+
class Reporter::GithubReporter < Reporter
|
6
|
+
ESCAPE_MAP = { '%' => '%25', "\n" => '%0A', "\r" => '%0D' }.freeze
|
7
|
+
|
8
|
+
include Reporter::Utils
|
9
|
+
|
10
|
+
def added_lint(lint, report)
|
11
|
+
if lint.severity >= report.fail_level
|
12
|
+
print_workflow_command(lint: lint)
|
13
|
+
else
|
14
|
+
print_workflow_command(severity: 'warning', lint: lint)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def display_report(report)
|
19
|
+
print_summary(report)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def print_workflow_command(lint:, severity: 'error')
|
25
|
+
log.log "::#{severity} file=#{lint.filename},line=#{lint.line}::#{github_escape(lint.message)}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def github_escape(string)
|
29
|
+
string.gsub(Regexp.union(ESCAPE_MAP.keys), ESCAPE_MAP)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -247,31 +247,29 @@ module HamlLint::RubyExtraction
|
|
247
247
|
def visit_tag(node)
|
248
248
|
indent = @original_haml_lines[node.line - 1].index(/\S/)
|
249
249
|
|
250
|
+
@ruby_chunks << PlaceholderMarkerChunk.new(node, 'tag', indent: indent)
|
251
|
+
|
252
|
+
current_line_index = visit_tag_attributes(node, indent: indent)
|
253
|
+
visit_tag_script(node, line_index: current_line_index, indent: indent)
|
254
|
+
|
250
255
|
# We don't want to use a block because assignments in a block are local to that block,
|
251
256
|
# so the semantics of the extracted ruby would be different from the one generated by
|
252
257
|
# Haml. Those differences can make some cops, such as UselessAssignment, have false
|
253
258
|
# positives
|
254
259
|
code = 'begin'
|
255
|
-
|
256
|
-
|
257
|
-
indent += 2
|
258
|
-
|
259
|
-
tag_chunk = PlaceholderMarkerChunk.new(node, 'tag', indent: indent)
|
260
|
-
@ruby_chunks << tag_chunk
|
260
|
+
begin_chunk = AdHocChunk.new(node, [' ' * indent + code])
|
261
|
+
@ruby_chunks << begin_chunk
|
261
262
|
|
262
|
-
|
263
|
-
visit_tag_script(node, line_index: current_line_index, indent: indent)
|
263
|
+
indent += 2
|
264
264
|
|
265
265
|
yield
|
266
266
|
|
267
267
|
indent -= 2
|
268
268
|
|
269
|
-
if @ruby_chunks.last.equal?(
|
269
|
+
if @ruby_chunks.last.equal?(begin_chunk)
|
270
270
|
# So there is nothing going "in" the tag, remove the wrapping "begin" and replace the PlaceholderMarkerChunk
|
271
271
|
# by one less indented
|
272
272
|
@ruby_chunks.pop
|
273
|
-
@ruby_chunks.pop
|
274
|
-
@ruby_chunks << PlaceholderMarkerChunk.new(node, 'tag', indent: indent)
|
275
273
|
else
|
276
274
|
@ruby_chunks << AdHocChunk.new(node,
|
277
275
|
[' ' * indent + 'ensure', ' ' * indent + ' HL.noop', ' ' * indent + 'end'],
|
@@ -600,9 +598,12 @@ module HamlLint::RubyExtraction
|
|
600
598
|
return [char_index, [haml_processed_ruby_code]]
|
601
599
|
end
|
602
600
|
|
603
|
-
|
601
|
+
# The +1 is for the closing brace, which we need
|
602
|
+
min_non_white_chars_to_add = haml_processed_ruby_code.scan(/\S/).size + 1
|
604
603
|
|
605
|
-
regexp = HamlLint::Utils.regexp_for_parts(
|
604
|
+
regexp = HamlLint::Utils.regexp_for_parts(
|
605
|
+
haml_processed_ruby_code.split(/\s+/), '\\s+', prefix: '\s*', suffix: '\s*(?=[)}])'
|
606
|
+
)
|
606
607
|
|
607
608
|
joined_lines = first_line.rstrip
|
608
609
|
process_multiline!(joined_lines)
|
@@ -624,7 +625,7 @@ module HamlLint::RubyExtraction
|
|
624
625
|
|
625
626
|
first_line_offset = match.begin(0)
|
626
627
|
raw_ruby = match[0]
|
627
|
-
ruby_lines = raw_ruby.split("\n")
|
628
|
+
ruby_lines = raw_ruby.split("\n", -1)
|
628
629
|
|
629
630
|
[first_line_offset, ruby_lines]
|
630
631
|
end
|
data/lib/haml_lint/runner.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'parallel'
|
4
|
+
require_relative 'source'
|
4
5
|
|
5
6
|
module HamlLint
|
6
7
|
# Responsible for running the applicable linters against the desired files.
|
@@ -20,12 +21,13 @@ module HamlLint
|
|
20
21
|
# @return [HamlLint::Report] a summary of all lints found
|
21
22
|
def run(options = {})
|
22
23
|
@config = load_applicable_config(options)
|
23
|
-
@
|
24
|
+
@sources = extract_applicable_sources(config, options)
|
24
25
|
@linter_selector = HamlLint::LinterSelector.new(config, options)
|
25
26
|
@fail_fast = options.fetch(:fail_fast, false)
|
26
27
|
@cache = {}
|
27
28
|
@autocorrect = options[:autocorrect]
|
28
29
|
@autocorrect_only = options[:autocorrect_only]
|
30
|
+
@autocorrect_stdout = options[:stdin] && options[:stderr]
|
29
31
|
|
30
32
|
report(options)
|
31
33
|
end
|
@@ -48,10 +50,10 @@ module HamlLint
|
|
48
50
|
# @return [true, false]
|
49
51
|
alias fail_fast? fail_fast
|
50
52
|
|
51
|
-
# The list of
|
53
|
+
# The list of sources to lint during this run.
|
52
54
|
#
|
53
|
-
# @return [Array<
|
54
|
-
attr_reader :
|
55
|
+
# @return [Array<HamlLint::Source>]
|
56
|
+
attr_reader :sources
|
55
57
|
|
56
58
|
# The selector for which linters to run during this run.
|
57
59
|
#
|
@@ -79,18 +81,20 @@ module HamlLint
|
|
79
81
|
# Runs all provided linters using the specified config against the given
|
80
82
|
# file.
|
81
83
|
#
|
82
|
-
# @param
|
84
|
+
# @param source [HamlLint::Source] source to lint
|
83
85
|
# @param linter_selector [HamlLint::LinterSelector]
|
84
86
|
# @param config [HamlLint::Configuration]
|
85
|
-
def collect_lints(
|
87
|
+
def collect_lints(source, linter_selector, config)
|
86
88
|
begin
|
87
|
-
document = HamlLint::Document.new
|
89
|
+
document = HamlLint::Document.new source.contents, file: source.path,
|
90
|
+
config: config,
|
91
|
+
write_to_stdout: @autocorrect_stdout
|
88
92
|
rescue HamlLint::Exceptions::ParseError => e
|
89
|
-
return [HamlLint::Lint.new(HamlLint::Linter::Syntax.new(config),
|
93
|
+
return [HamlLint::Lint.new(HamlLint::Linter::Syntax.new(config), source.path,
|
90
94
|
e.line, e.to_s, :error)]
|
91
95
|
end
|
92
96
|
|
93
|
-
linters = linter_selector.linters_for_file(
|
97
|
+
linters = linter_selector.linters_for_file(source.path)
|
94
98
|
lint_arrays = []
|
95
99
|
|
96
100
|
if @autocorrect
|
@@ -125,40 +129,46 @@ module HamlLint
|
|
125
129
|
lint_arrays
|
126
130
|
end
|
127
131
|
|
128
|
-
# Returns the list of
|
132
|
+
# Returns the list of sources that should be linted given the specified
|
129
133
|
# configuration and options.
|
130
134
|
#
|
131
135
|
# @param config [HamlLint::Configuration]
|
132
136
|
# @param options [Hash]
|
133
|
-
# @return [Array<
|
134
|
-
def
|
135
|
-
|
136
|
-
|
137
|
-
|
137
|
+
# @return [Array<HamlLint::Source>]
|
138
|
+
def extract_applicable_sources(config, options)
|
139
|
+
if options[:stdin]
|
140
|
+
[HamlLint::Source.new(io: $stdin, path: options[:stdin])]
|
141
|
+
else
|
142
|
+
included_patterns = options[:files]
|
143
|
+
excluded_patterns = config['exclude']
|
144
|
+
excluded_patterns += options.fetch(:excluded_files, [])
|
138
145
|
|
139
|
-
|
146
|
+
HamlLint::FileFinder.new(config).find(included_patterns, excluded_patterns).map do |file_path|
|
147
|
+
HamlLint::Source.new path: file_path
|
148
|
+
end
|
149
|
+
end
|
140
150
|
end
|
141
151
|
|
142
|
-
# Process the
|
152
|
+
# Process the sources and add them to the given report.
|
143
153
|
#
|
144
154
|
# @param report [HamlLint::Report]
|
145
155
|
# @return [void]
|
146
|
-
def
|
147
|
-
|
148
|
-
|
156
|
+
def process_sources(report)
|
157
|
+
sources.each do |source|
|
158
|
+
process_source(source, report)
|
149
159
|
break if report.failed? && fail_fast?
|
150
160
|
end
|
151
161
|
end
|
152
162
|
|
153
163
|
# Process a file and add it to the given report.
|
154
164
|
#
|
155
|
-
# @param
|
165
|
+
# @param source [HamlLint::Source] the source to process
|
156
166
|
# @param report [HamlLint::Report]
|
157
167
|
# @return [void]
|
158
|
-
def
|
159
|
-
lints = @cache[
|
168
|
+
def process_source(source, report)
|
169
|
+
lints = @cache[source.path] || collect_lints(source, linter_selector, config)
|
160
170
|
lints.each { |lint| report.add_lint(lint) }
|
161
|
-
report.finish_file(
|
171
|
+
report.finish_file(source.path, lints)
|
162
172
|
end
|
163
173
|
|
164
174
|
# Generates a report based on the given options.
|
@@ -168,9 +178,9 @@ module HamlLint
|
|
168
178
|
# @return [HamlLint::Report]
|
169
179
|
def report(options)
|
170
180
|
report = HamlLint::Report.new(reporter: options[:reporter], fail_level: options[:fail_level])
|
171
|
-
report.start(
|
181
|
+
report.start(sources.map(&:path))
|
172
182
|
warm_cache if options[:parallel]
|
173
|
-
|
183
|
+
process_sources(report)
|
174
184
|
report
|
175
185
|
end
|
176
186
|
|
@@ -178,9 +188,9 @@ module HamlLint
|
|
178
188
|
#
|
179
189
|
# @return [void]
|
180
190
|
def warm_cache
|
181
|
-
results = Parallel.map(
|
182
|
-
lints = collect_lints(
|
183
|
-
[
|
191
|
+
results = Parallel.map(sources) do |source|
|
192
|
+
lints = collect_lints(source, linter_selector, config)
|
193
|
+
[source.path, lints]
|
184
194
|
end
|
185
195
|
@cache = results.to_h
|
186
196
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HamlLint
|
4
|
+
# Wrapper class representing a single target for HamlLint::Runner to run against, comprised of a file path to
|
5
|
+
# eventually read from, and an optional IO argument to override with.
|
6
|
+
class Source
|
7
|
+
# @return [String] File path associated with the given IO object.
|
8
|
+
attr_reader :path
|
9
|
+
|
10
|
+
# Wraps an optional IO object and file path to a source object.
|
11
|
+
#
|
12
|
+
# @param [String] path
|
13
|
+
# @param [IO] io
|
14
|
+
def initialize(path: nil, io: nil)
|
15
|
+
@path = path
|
16
|
+
@io = io
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return [String] Contents of the given IO object.
|
20
|
+
def contents
|
21
|
+
@contents ||= @io&.read || File.read(path)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -115,7 +115,7 @@ module HamlLint
|
|
115
115
|
|
116
116
|
syntax_lints = subject.lints.select { |lint| lint.message =~ %r{Lint/Syntax} }
|
117
117
|
|
118
|
-
if start_ruby.strip != 'SKIP' && subject.last_extracted_source
|
118
|
+
if start_ruby.strip != 'SKIP' && subject.last_extracted_source && ENV['UPDATE_EXAMPLES'] != '1'
|
119
119
|
matcher = eq(start_ruby)
|
120
120
|
subject.last_extracted_source.source.should(
|
121
121
|
matcher,
|
@@ -125,7 +125,7 @@ module HamlLint
|
|
125
125
|
|
126
126
|
syntax_lints.should(be_empty, "Generated Ruby has Syntax Lints:\n#{format_lints(syntax_lints)}")
|
127
127
|
|
128
|
-
if end_ruby.strip != 'SKIP' && subject.last_new_ruby_source
|
128
|
+
if end_ruby.strip != 'SKIP' && subject.last_new_ruby_source && ENV['UPDATE_EXAMPLES'] != '1'
|
129
129
|
matcher = eq(end_ruby)
|
130
130
|
subject.last_new_ruby_source.should(
|
131
131
|
matcher,
|
@@ -141,10 +141,40 @@ module HamlLint
|
|
141
141
|
-> { "Final HAML is different from expected. #{matcher.failure_message}\n#{format_lints}" }
|
142
142
|
)
|
143
143
|
|
144
|
-
if subject.last_extracted_source && start_ruby.strip != 'SKIP'
|
144
|
+
if subject.last_extracted_source && start_ruby.strip != 'SKIP' && ENV['UPDATE_EXAMPLES'] != '1'
|
145
145
|
subject.last_extracted_source.source_map.should == source_map
|
146
146
|
end
|
147
147
|
|
148
|
+
if ENV['UPDATE_EXAMPLES'] == '1' && respond_to?(:example_first_line_no) &&
|
149
|
+
start_ruby.strip != 'SKIP' && end_ruby.strip != 'SKIP'
|
150
|
+
original_content = File.read(example_path)
|
151
|
+
old_steps_string = '---' + steps_string.partition('---').last.rpartition('---').first + '---'
|
152
|
+
|
153
|
+
if old_steps_string.scan(/\$\$\d+/).tally.values.any? { |v| v > 1 }
|
154
|
+
# If the $$3 was there twice, let's not update the example
|
155
|
+
return
|
156
|
+
end
|
157
|
+
original_content.scan(old_steps_string).count
|
158
|
+
|
159
|
+
new_generated_ruby_lines = subject.last_extracted_source.source.split("\n", -1)
|
160
|
+
last_seen_haml_line_no = 1
|
161
|
+
subject.last_extracted_source.source_map.each do |ruby_line_no, haml_line_no|
|
162
|
+
if haml_line_no != last_seen_haml_line_no
|
163
|
+
last_seen_haml_line_no = haml_line_no
|
164
|
+
new_generated_ruby_lines[ruby_line_no - 1] += " $$#{haml_line_no}"
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
new_steps_string = <<~NEW.chop # Chop to remove the added newlines
|
169
|
+
---
|
170
|
+
#{new_generated_ruby_lines.join("\n")}---
|
171
|
+
#{subject.last_new_ruby_source}---
|
172
|
+
NEW
|
173
|
+
|
174
|
+
new_content = original_content.gsub(old_steps_string, new_steps_string)
|
175
|
+
File.write(example_path, new_content)
|
176
|
+
end
|
177
|
+
|
148
178
|
haml_different = start_haml != end_haml
|
149
179
|
document.source_was_changed.should == haml_different
|
150
180
|
end
|
data/lib/haml_lint/utils.rb
CHANGED
@@ -277,8 +277,9 @@ module HamlLint
|
|
277
277
|
$stdin = original_stdin
|
278
278
|
end
|
279
279
|
|
280
|
-
def regexp_for_parts(parts, join_regexp)
|
280
|
+
def regexp_for_parts(parts, join_regexp, prefix: nil, suffix: nil)
|
281
281
|
regexp_code = parts.map { |c| Regexp.quote(c) }.join(join_regexp)
|
282
|
+
regexp_code = "#{prefix}#{regexp_code}#{suffix}"
|
282
283
|
Regexp.new(regexp_code)
|
283
284
|
end
|
284
285
|
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.57.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- lib/haml_lint/reporter/checkstyle_reporter.rb
|
154
154
|
- lib/haml_lint/reporter/default_reporter.rb
|
155
155
|
- lib/haml_lint/reporter/disabled_config_reporter.rb
|
156
|
+
- lib/haml_lint/reporter/github_reporter.rb
|
156
157
|
- lib/haml_lint/reporter/hash_reporter.rb
|
157
158
|
- lib/haml_lint/reporter/hooks.rb
|
158
159
|
- lib/haml_lint/reporter/json_reporter.rb
|
@@ -176,6 +177,7 @@ files:
|
|
176
177
|
- lib/haml_lint/ruby_parser.rb
|
177
178
|
- lib/haml_lint/runner.rb
|
178
179
|
- lib/haml_lint/severity.rb
|
180
|
+
- lib/haml_lint/source.rb
|
179
181
|
- lib/haml_lint/spec.rb
|
180
182
|
- lib/haml_lint/spec/matchers/report_lint.rb
|
181
183
|
- lib/haml_lint/spec/normalize_indent.rb
|
@@ -199,7 +201,7 @@ homepage: https://github.com/sds/haml-lint
|
|
199
201
|
licenses:
|
200
202
|
- MIT
|
201
203
|
metadata: {}
|
202
|
-
post_install_message:
|
204
|
+
post_install_message:
|
203
205
|
rdoc_options: []
|
204
206
|
require_paths:
|
205
207
|
- lib
|
@@ -207,15 +209,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
209
|
requirements:
|
208
210
|
- - ">="
|
209
211
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
212
|
+
version: '3.0'
|
211
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
214
|
requirements:
|
213
215
|
- - ">="
|
214
216
|
- !ruby/object:Gem::Version
|
215
217
|
version: '0'
|
216
218
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
218
|
-
signing_key:
|
219
|
+
rubygems_version: 3.4.10
|
220
|
+
signing_key:
|
219
221
|
specification_version: 4
|
220
222
|
summary: HAML lint tool
|
221
223
|
test_files: []
|