Closed carbonComputer closed 6 years ago
Recommend you disable the Layout/EmptyLineAfterGuardClause
for any files in the directory in question. So if you store your HAML templates in app/views/*
, you can write:
#.rubocop.yml
Layout/EmptyLineAfterGuardClause:
exclude: 'app/views/**'
...or similar.
Bumped into the same issue. We have an empty line after the guard clause, but the cop still triggers.
Isn't there a way to fix the cop to work with HAML? it's still useful to have it for guard clauses in HAML, isn't it?
I know this is super late to the game but I think it is possible recent improvements to the project have fixed this issue. I was able to enforce Layout/EmptyLineAfterGuardClause in our views just now and was even able to autofix all the errors. We had originally disabled this rule in our views years ago seeing some similar issues to the one reported in this issue.
Oh, that makes sense. The new system does transfer blank lines from the HAML to the Ruby code that gets corrected.
Our app has several guards in haml like
- return unless
supported_browser?` This will always be triggered when we lint.How do we workaround this issue?