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

[red-knot] Detect version-related syntax errors #16379

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Feb 25, 2025

Summary

This is a follow-up to #16090. The main issue pointed out in #16090 (comment) is passing the Python version into parsed_module. I need to resolve that before taking this out of draft.

Depending on the sequencing of these PRs, this branch may also need to add mdtests for each syntax error detected in the parser.

Test Plan

New mdtests.

@ntBre ntBre added the red-knot Multi-file analysis & type inference label Feb 25, 2025
@ntBre ntBre changed the title [red-knot] Detect version-related syntax errors [red-knot] Detect version-related syntax errors Feb 25, 2025
@ntBre ntBre force-pushed the brent/syntax-errors-red-knot branch 3 times, most recently from 8014499 to f0005f7 Compare February 25, 2025 19:01
Copy link

codspeed-hq bot commented Feb 25, 2025

CodSpeed Performance Report

Merging #16379 will not alter performance

Comparing brent/syntax-errors-red-knot (bc274bd) with main (7880636)

Summary

✅ 32 untouched benchmarks

Copy link
Contributor

github-actions bot commented Feb 25, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

ntBre added a commit that referenced this pull request Feb 25, 2025
This PR is the first in a series derived from #16308, each of which add support
for detecting one version-related syntax error from #6591. This one should be
the largest because it also includes a couple of additional changes:
1. the `syntax_errors!` macro, which makes adding more variants a bit easier
2. the `Parser::add_unsupported_syntax_error` method

Otherwise I think the general structure will be the same for each syntax error:
* Detecting the error in the parser
* Inline parser tests for the new error
* New ruff CLI tests for the new error

Because of the second point here, this PR is currently stacked on #16357.

As noted above, there are new inline parser tests, as well as new ruff CLI
tests. Once #16379 is resolved, there should also be new mdtests for red-knot,
but this PR does not currently include those.
ntBre added a commit that referenced this pull request Feb 26, 2025
This PR is the first in a series derived from #16308, each of which add support
for detecting one version-related syntax error from #6591. This one should be
the largest because it also includes a couple of additional changes:
1. the `syntax_errors!` macro, which makes adding more variants a bit easier
2. the `Parser::add_unsupported_syntax_error` method

Otherwise I think the general structure will be the same for each syntax error:
* Detecting the error in the parser
* Inline parser tests for the new error
* New ruff CLI tests for the new error

Because of the second point here, this PR is currently stacked on #16357.

As noted above, there are new inline parser tests, as well as new ruff CLI
tests. Once #16379 is resolved, there should also be new mdtests for red-knot,
but this PR does not currently include those.
Base automatically changed from brent/syntax-errors-parser to main February 26, 2025 04:03
@ntBre ntBre force-pushed the brent/syntax-errors-red-knot branch from f0005f7 to bc274bd Compare February 26, 2025 04:15
ntBre added a commit that referenced this pull request Feb 26, 2025
This PR is the first in a series derived from #16308, each of which add support
for detecting one version-related syntax error from #6591. This one should be
the largest because it also includes a couple of additional changes:
1. the `syntax_errors!` macro, which makes adding more variants a bit easier
2. the `Parser::add_unsupported_syntax_error` method

Otherwise I think the general structure will be the same for each syntax error:
* Detecting the error in the parser
* Inline parser tests for the new error
* New ruff CLI tests for the new error

Because of the second point here, this PR is currently stacked on #16357.

As noted above, there are new inline parser tests, as well as new ruff CLI
tests. Once #16379 is resolved, there should also be new mdtests for red-knot,
but this PR does not currently include those.
ntBre added a commit that referenced this pull request Feb 27, 2025
This PR is the first in a series derived from #16308, each of which add support
for detecting one version-related syntax error from #6591. This one should be
the largest because it also includes a couple of additional changes:
1. the `syntax_errors!` macro, which makes adding more variants a bit easier
2. the `Parser::add_unsupported_syntax_error` method

Otherwise I think the general structure will be the same for each syntax error:
* Detecting the error in the parser
* Inline parser tests for the new error
* New ruff CLI tests for the new error

Because of the second point here, this PR is currently stacked on #16357.

As noted above, there are new inline parser tests, as well as new ruff CLI
tests. Once #16379 is resolved, there should also be new mdtests for red-knot,
but this PR does not currently include those.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant