haml_lint 0.70.0 → 0.71.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: afe284adb597f41b6999969d0d0220146f80e9899cb71101e9de112bf4f79f80
|
|
4
|
+
data.tar.gz: 225845ad81e2517e0c295e41310ce1edbe0581a823bc8985225dc0699d9e8527
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6f8b34ad2587598c1c5c72b3b394d17b7d791c025b601437ffdab437ed7d8470fb54a28033d490da70deb3202827cc54e7acb6ec5d0a80b9fca6936396e5f98
|
|
7
|
+
data.tar.gz: 634e4e861509306b3fb9da905b9557eb61ea0ff11b1427b0c3f62b4450c723af48eb1d27dfc1c568181a1053ba52dcb286ffaefe94c377ae1e1b5430754dc3b5
|
|
@@ -94,7 +94,7 @@ module HamlLint
|
|
|
94
94
|
@last_extracted_source = nil
|
|
95
95
|
@last_new_ruby_source = nil
|
|
96
96
|
|
|
97
|
-
coordinator = HamlLint::RubyExtraction::Coordinator.new(document
|
|
97
|
+
coordinator = HamlLint::RubyExtraction::Coordinator.new(document)
|
|
98
98
|
|
|
99
99
|
extracted_source = coordinator.extract_ruby_source
|
|
100
100
|
if ENV['HAML_LINT_INTERNAL_DEBUG'] == 'true'
|
|
@@ -9,7 +9,7 @@ module HamlLint::RubyExtraction
|
|
|
9
9
|
class ChunkExtractor
|
|
10
10
|
include HamlLint::HamlVisitor
|
|
11
11
|
|
|
12
|
-
attr_reader :script_output_prefix
|
|
12
|
+
attr_reader :script_output_prefix
|
|
13
13
|
|
|
14
14
|
HAML_PARSER_INSTANCE = if Haml::VERSION >= '5.0.0'
|
|
15
15
|
::Haml::Parser.new({})
|
|
@@ -21,10 +21,9 @@ module HamlLint::RubyExtraction
|
|
|
21
21
|
# We don't. So the regex must be fixed to correctly detect the start of the string.
|
|
22
22
|
BLOCK_KEYWORD_REGEX = Regexp.new(Haml::Parser::BLOCK_KEYWORD_REGEX.source.sub('^', '\A'))
|
|
23
23
|
|
|
24
|
-
def initialize(document, script_output_prefix
|
|
24
|
+
def initialize(document, script_output_prefix:)
|
|
25
25
|
@document = document
|
|
26
26
|
@script_output_prefix = script_output_prefix
|
|
27
|
-
@autocorrect = autocorrect
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
def extract
|
|
@@ -638,20 +637,8 @@ module HamlLint::RubyExtraction
|
|
|
638
637
|
def wrap_lines(lines, wrap_depth)
|
|
639
638
|
lines = lines.dup
|
|
640
639
|
wrapping_prefix = 'W' * (wrap_depth - 1) + '('
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
# SpaceInsideParens violations. During autocorrect, preserve spaces so RuboCop
|
|
644
|
-
# can fix them and map corrections back correctly.
|
|
645
|
-
if autocorrect
|
|
646
|
-
lines[0] = wrapping_prefix + lines[0]
|
|
647
|
-
lines[-1] = lines[-1] + ')'
|
|
648
|
-
else
|
|
649
|
-
leading_spaces = lines[0][/^\s*/].length
|
|
650
|
-
wrapping_prefix = 'W' * (wrap_depth - 1 + leading_spaces) + '('
|
|
651
|
-
lines[0] = wrapping_prefix + lines[0].lstrip
|
|
652
|
-
lines[-1] = lines[-1].rstrip + ')'
|
|
653
|
-
end
|
|
654
|
-
|
|
640
|
+
lines[0] = wrapping_prefix + lines[0]
|
|
641
|
+
lines[-1] = lines[-1] + ')'
|
|
655
642
|
lines
|
|
656
643
|
end
|
|
657
644
|
|
|
@@ -28,12 +28,8 @@ module HamlLint::RubyExtraction
|
|
|
28
28
|
# @return [Array<String>] The ruby lines after correction by RuboCop
|
|
29
29
|
attr_reader :corrected_ruby_lines
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
attr_reader :autocorrect
|
|
33
|
-
|
|
34
|
-
def initialize(document, autocorrect:)
|
|
31
|
+
def initialize(document)
|
|
35
32
|
@document = document
|
|
36
|
-
@autocorrect = autocorrect
|
|
37
33
|
@ruby_chunks = nil
|
|
38
34
|
@assembled_ruby_lines = nil
|
|
39
35
|
@corrected_ruby_lines = nil
|
|
@@ -50,8 +46,7 @@ module HamlLint::RubyExtraction
|
|
|
50
46
|
pick_a_script_output_prefix
|
|
51
47
|
|
|
52
48
|
@ruby_chunks = HamlLint::RubyExtraction::ChunkExtractor.new(@document,
|
|
53
|
-
script_output_prefix: @script_output_prefix
|
|
54
|
-
autocorrect: autocorrect).extract
|
|
49
|
+
script_output_prefix: @script_output_prefix).extract
|
|
55
50
|
preprocess_chunks
|
|
56
51
|
|
|
57
52
|
@assembled_ruby_lines = []
|
data/lib/haml_lint/version.rb
CHANGED