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

Rubocop cop Layout/EmptyLineAfterGuardClause not working properly #178

Open
danarnold opened this issue May 6, 2024 · 0 comments
Open

Comments

@danarnold
Copy link

danarnold commented May 6, 2024

The Rubocop cop Layout/EmptyLineAfterGuardClause appears to trigger with slim-lint for every guard clause, regardless of whether there's an empty line after it or not.

Example:

test.html.slim

- arr = [1, 2, 3]
- arr.each do |e|
  - next if e == 2

  = e
$ bundle exec slim-lint test.html.slim
test.html.slim:3 [W] RuboCop: Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.

Adding an empty code line doesn't fix it either, but just adds another warning:

- arr = [1, 2, 3]
- arr.each do |e|
  - next if e == 2
  -
  = e
$ bundle exec slim-lint test.html.slim
test.html.slim:3 [W] RuboCop: Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
test.html.slim:4 [W] EmptyControlStatement: Empty control statement can be removed

Versions:
slim-lint 0.27.0
rubocop 1.63.4

@danarnold danarnold changed the title Layout/EmptyLineAfterGuardClause not working properly Rubocop cop Layout/EmptyLineAfterGuardClause not working properly May 6, 2024
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

No branches or pull requests

1 participant