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

[pyflakes] Show syntax error message for F722 #15523

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Jan 16, 2025

Summary

Ref: #15387 (comment)

This PR updates F722 to show syntax error message instead of the string content.

I think it's more useful to show the syntax error message than the string content. In the future, when the diagnostics renderer is more capable, we could even highlight the exact location of the syntax error along with the annotation string.

This is also in line with how we show the diagnostic in red knot.

Test Plan

Update existing test snapshots.

@dhruvmanila dhruvmanila added rule Implementing or modifying a lint rule diagnostics Related to reporting of diagnostics. labels Jan 16, 2025
@dhruvmanila
Copy link
Member Author

(Tagging @BurntSushi as it's related to diagnostics.)

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Nice.

the ideal result here might be to actually support diagnostic chains, where a diagnostic can have an inner diagnostic.

@dhruvmanila dhruvmanila merged commit 79e52c7 into main Jan 16, 2025
21 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/annotation-syntax-error branch January 16, 2025 07:14
Copy link
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

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

Nice! LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostics Related to reporting of diagnostics. rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants