Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Rubocop Layout/IndentationConsistency interaction with haml comment blocks #468

Closed
mjankowski opened this issue Jan 5, 2024 · 2 comments · Fixed by #469
Closed

Comments

@mjankowski
Copy link
Contributor

Given an html layout like:

!!!
%html
  %head
    /[if mso]
      <xml></xml>
  %body

Running haml-lint with rubocop enabled generates a "RuboCop: Layout/IndentationConsistency: Inconsistent indentation detected" failure.

The linter seems to want the contents of the html comment to be aligned with the start of the comment block -- I'm guessing that in the ruby<>haml translation something is lost here. Longer context/description: mastodon/mastodon#28416 (comment)

Is there an obvious workaround or better haml approach here? Am I understanding what's happening? Would love guidance on best approach here (is this a haml lint bug? should we just disable that specific rubocop rule? etc)

@MaxLap
Copy link
Contributor

MaxLap commented Jan 5, 2024

I have never seen the /[ ] syntax, so it's definetly not tested and there is probably a problem with it.

I will try to take a look at this soon.

@mjankowski
Copy link
Contributor Author

Awesome, thanks for quick reply. I think that syntax is a special casing of more general comment syntax, and is narrowly for "conditional comments" - https://haml.info/docs/yardoc/file.REFERENCE.html#conditional-comments- - for IE, Outlook, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants