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

False positives with Style/DisableCopsWithinSourceCodeDirective. #406

Closed
mockdeep opened this issue Jun 28, 2023 · 2 comments
Closed

False positives with Style/DisableCopsWithinSourceCodeDirective. #406

mockdeep opened this issue Jun 28, 2023 · 2 comments

Comments

@mockdeep
Copy link
Contributor

mockdeep commented Jun 28, 2023

When upgrading to version 0.46.0, we're seeing a lot of false positives with the Style/DisableCopsWithinSourceCodeDirective linter. The following line triggers it for some reason:

%li.tab-navigation__tab{ **tab_attributes }
@MaxLap
Copy link
Contributor

MaxLap commented Jun 29, 2023

I'm learning about a new Cop I didn't know about...

We use the begin # rubocop:disable Style/RedundantBegin,Lint/RedundantCopDisableDirective when we encounter tags to add valid indentation to the Ruby code send to Rubocop. (Using a block would cause scoping issues with variables)

I made a PR (#412) to fix this by instead adding a ensure to the begin and remove the disables. This should fix your issue.

In the meantime, I can only suggest to disable DisableCopsWithinSourceCodeDirective or to add AllowedCops for Style/RedundantBegin and Lint/RedundantCopDisableDirective

@MaxLap
Copy link
Contributor

MaxLap commented Jul 5, 2023

Haml-Lint 0.47.0 has been released which fixes this. This can be closed

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

No branches or pull requests

3 participants