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: 7b1a2ca29afbb8764cf0932d560901cd9b2af889701386bf398a464b94d331bc
4
- data.tar.gz: 82e6c7e54a0bd3c1d8f4159893af0bfb0c16c81dca993a9aaf6e875544d79269
3
+ metadata.gz: afe284adb597f41b6999969d0d0220146f80e9899cb71101e9de112bf4f79f80
4
+ data.tar.gz: 225845ad81e2517e0c295e41310ce1edbe0581a823bc8985225dc0699d9e8527
5
5
  SHA512:
6
- metadata.gz: 754e6ad2de8723a619eb4b24204e8231fead3443c35080c073fbc8e68a15cadace16eb5635c86bea78eee28831de1ef4ba8afadc4e22156f4c6edd6155df42b7
7
- data.tar.gz: f533a65a21402e75970431c7e82b7b82f111b12d584568b8fd38ff25fd21d258c76e81d562c7b23d439fe1055f01f95897fbc1bc787cc599b8430baa30260857
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, autocorrect: @autocorrect)
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, :autocorrect
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:, autocorrect: nil)
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
- # Strip leading/trailing space only when linting (not autocorrecting) to avoid
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
- # @return [Symbol, nil] The autocorrect mode (:safe, :all, or nil)
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 = []
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module HamlLint
5
- VERSION = '0.70.0'
5
+ VERSION = '0.71.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.70.0
4
+ version: 0.71.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva