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

Update E999 to show all syntax errors #11900

Merged
merged 1 commit into from
Jun 19, 2024
Merged

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Jun 17, 2024

Summary

This PR updates the linter to show all the parse errors as diagnostics instead of just the first one.

Note that this doesn't affect the parse error displayed as error log message. This will be removed in a follow-up PR.

Breaking?

I don't think this is a breaking change even though this might give more diagnostics. The main reason is that this shouldn't affect any users because it'll only give additional diagnostics in the case of multiple syntax errors.

Test Plan

Add an integration test case which would raise more than one parse error.

@dhruvmanila dhruvmanila added the rule Implementing or modifying a lint rule label Jun 18, 2024
@dhruvmanila dhruvmanila changed the title Show all parse errors as diagnostics Update E999 to show all syntax errors Jun 18, 2024
Copy link
Contributor

github-actions bot commented Jun 18, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+1 -0 violations, +0 -0 fixes in 1 projects; 49 projects unchanged)

demisto/content (+1 -0 violations, +0 -0 fixes)

+ Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py:325:8: E999 SyntaxError: Multiple exception types must be parenthesized

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
E999 1 1 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+1 -0 violations, +0 -0 fixes in 1 projects; 49 projects unchanged)

demisto/content (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py:325:8: E999 SyntaxError: Multiple exception types must be parenthesized

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
E999 1 1 0 0 0

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@dhruvmanila dhruvmanila marked this pull request as ready for review June 18, 2024 09:42
pycodestyle::rules::syntax_error(&mut diagnostics, parse_error, locator);
for parse_error in parse_errors {
pycodestyle::rules::syntax_error(&mut diagnostics, parse_error, locator);
}
// TODO(dhruvmanila): Remove this clone
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the TODO :P

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#11903 ;)

@dhruvmanila dhruvmanila merged commit b617d90 into main Jun 19, 2024
20 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/syntax-error-1 branch June 19, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants