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

Lint/Syntax is suppressed when using the "--only" flag #11697

Closed
matthewhively opened this issue Mar 14, 2023 · 0 comments · Fixed by #11733
Closed

Lint/Syntax is suppressed when using the "--only" flag #11697

matthewhively opened this issue Mar 14, 2023 · 0 comments · Fixed by #11733
Labels

Comments

@matthewhively
Copy link

matthewhively commented Mar 14, 2023

When running rubocop for a specific cop using the --only flag on a specific file, and that file has syntax errors. Rubocop $? -eq 0
This is counter-intuitive because rubocop cannot successfully parse the file to actually check the cop requested. So it should be a failure.

I would suggest that Lint/Syntax should always be reported even when the --only flag is used. Maybe internally always prepend --only <list> with Lint/Syntax ?


rubocop --version
1.28.2 (latest for ruby 2.5)

@koic koic added the bug label Mar 24, 2023
koic added a commit to koic/rubocop that referenced this issue Mar 24, 2023
…tion

Fixes rubocop#11697.

This PR fixes `Lint/Syntax` behavior when `--only` is not given the cop name.
The cop must always be executed.
bbatsov pushed a commit that referenced this issue Mar 25, 2023
Fixes #11697.

This PR fixes `Lint/Syntax` behavior when `--only` is not given the cop name.
The cop must always be executed.
camilopayan added a commit to standardrb/standard that referenced this issue Apr 19, 2023
You can watch this get configured live!
https://www.youtube.com/watch?v=8rLe_qmH84k

This also fixes a test that broke when [this issue in Rubocop for
Lint/Syntax was fixed](rubocop/rubocop#11697).

Co-authored-by: Daniel Huss <daniel.huss@testdouble.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants