sds/haml-lint

Failing spec on main branch

tagliala opened this issue · 2 comments

macOS 14.0
Ruby 3.2 (and 3.1)
Commit: ccdaed5

Failures:

  1) HamlLint::Linter::RuboCop autocorrect edge cases correct multiline brace layout of new_line with right indentation in silent script is expected to eq "%tag\n  - a = render 'something',\n               locals: { foo: bar,\n                         spam: 'more',\n    }\n"
     Failure/Error:
       document.source.should(
         matcher,
         -> { "Final HAML is different from expected. #{matcher.failure_message}\n#{format_lints}" }
       )
     
       Final HAML is different from expected. 
       expected: "%tag\n  - a = render 'something',\n               locals: { foo: bar,\n                         spam: 'more',\n    }\n"
            got: "%tag\n  - render 'something',\n           locals: { foo: bar,\n                     spam: 'more',\n    }\n"
     
       (compared using ==)
     
       2:Lint/UselessAssignment: Useless assignment to variable - `a`.
       3:Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
       3:Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
       3:Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
       4:Layout/HashAlignment: Align the keys of a hash literal if they span more than one line.
       4:Layout/SpaceAfterComma: Space missing after comma.
       4:Layout/MultilineHashBraceLayout: Closing hash brace must be on the line after the last hash element.
       4:Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
       4:Layout/TrailingWhitespace: Trailing whitespace detected.
       Diff:
       @@ -1,6 +1,6 @@
        %tag
       -  - a = render 'something',
       -               locals: { foo: bar,
       -                         spam: 'more',
       +  - render 'something',
       +           locals: { foo: bar,
       +                     spam: 'more',
            }
       
     # ./spec/haml_lint/linter/rubocop_autocorrect_edge_cases_spec.rb:218:in `block (4 levels) in <top (required)>'

  2) HamlLint::Linter::RuboCop autocorrect (script_examples.txt:484) Handles a for loop is expected to eq "haml_lint_marker_1\nfor value in list # rubocop:disable Style/For\n  HL.out = foo(bar: 123)\nend\nhaml_lint_marker_5\n"
     Failure/Error:
       subject.last_new_ruby_source.should(
         matcher,
         -> { "Ruby generated by RuboCop is different from expected. #{matcher.failure_message}\n#{format_lints}" }
       )
     
       Ruby generated by RuboCop is different from expected. 
       expected: "haml_lint_marker_1\nfor value in list # rubocop:disable Style/For\n  HL.out = foo(bar: 123)\nend\nhaml_lint_marker_5\n"
            got: "haml_lint_marker_1\nfor _ in list # rubocop:disable Style/For\n  HL.out = foo(bar: 123)\nend\nhaml_lint_marker_5\n"
     
       (compared using ==)
     
       1:Lint/UselessAssignment: Useless assignment to variable - `value`.
       2:Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
       2:Layout/SpaceAroundOperators: Operator `=>` should be surrounded by a single space.
       2:Layout/ExtraSpacing: Unnecessary spacing detected.
       Diff:
       @@ -1,5 +1,5 @@
        haml_lint_marker_1
       -for value in list # rubocop:disable Style/For
       +for _ in list # rubocop:disable Style/For
          HL.out = foo(bar: 123)
        end
        haml_lint_marker_5
       
     # ./lib/haml_lint/spec/shared_rubocop_autocorrect_context.rb:130:in `follows_steps'
     # ./spec/haml_lint/linter/rubocop_autocorrect_examples_spec.rb:15:in `block (6 levels) in <top (required)>'

  3) HamlLint::Linter::RuboCop autocorrect (script_examples.txt:556) multiline block using {} for lambda containing an if is expected to eq "haml_lint_marker_1\na = lambda do\n  if abc\n    something\n  end\nend\nhaml_lint_marker_7\n"
     Failure/Error:
       subject.last_new_ruby_source.should(
         matcher,
         -> { "Ruby generated by RuboCop is different from expected. #{matcher.failure_message}\n#{format_lints}" }
       )
     
       Ruby generated by RuboCop is different from expected. 
       expected: "haml_lint_marker_1\na = lambda do\n  if abc\n    something\n  end\nend\nhaml_lint_marker_7\n"
            got: "haml_lint_marker_1\nhaml_lint_marker_7\n"
     
       (compared using ==)
     
       1:Lint/UselessAssignment: Useless assignment to variable - `a`.
       1:Lint/Void: `lambda do
         if abc
           something
         end
       end` used in void context.
       1:Style/BlockDelimiters: Avoid using `{...}` for multi-line blocks.
       2:Layout/IndentationWidth: Use 2 (not 0) spaces for indentation.
       Diff:
       @@ -1,8 +1,3 @@
        haml_lint_marker_1
       -a = lambda do
       -  if abc
       -    something
       -  end
       -end
        haml_lint_marker_7
       
     # ./lib/haml_lint/spec/shared_rubocop_autocorrect_context.rb:130:in `follows_steps'
     # ./spec/haml_lint/linter/rubocop_autocorrect_examples_spec.rb:15:in `block (6 levels) in <top (required)>'

Finished in 8.13 seconds (files took 1.06 seconds to load)
1021 examples, 3 failures, 1 pending

Failed examples:

rspec ./spec/haml_lint/linter/rubocop_autocorrect_edge_cases_spec.rb:214 # HamlLint::Linter::RuboCop autocorrect edge cases correct multiline brace layout of new_line with right indentation in silent script is expected to eq "%tag\n  - a = render 'something',\n               locals: { foo: bar,\n                         spam: 'more',\n    }\n"
rspec ./spec/haml_lint/linter/rubocop_autocorrect_examples_spec.rb[1:1:179:1] # HamlLint::Linter::RuboCop autocorrect (script_examples.txt:484) Handles a for loop is expected to eq "haml_lint_marker_1\nfor value in list # rubocop:disable Style/For\n  HL.out = foo(bar: 123)\nend\nhaml_lint_marker_5\n"
rspec ./spec/haml_lint/linter/rubocop_autocorrect_examples_spec.rb[1:1:182:1] # HamlLint::Linter::RuboCop autocorrect (script_examples.txt:556) multiline block using {} for lambda containing an if is expected to eq "haml_lint_marker_1\na = lambda do\n  if abc\n    something\n  end\nend\nhaml_lint_marker_7\n"
MaxLap commented

Thanks for the report! I made a PR that fixes those issues. #448

Thanks. Rebasing #447