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

feat: implement TRY200 #2087

Merged
merged 2 commits into from
Jan 23, 2023
Merged

Conversation

karpa4o4
Copy link
Contributor

@karpa4o4 karpa4o4 commented Jan 22, 2023

@karpa4o4 karpa4o4 force-pushed the feat/tryceratops-TRY200 branch 3 times, most recently from 62c33f4 to f10d4de Compare January 22, 2023 15:12
checker.diagnostics.push(Diagnostic::new(
ReraiseNoCause,
Range::from_located(stmt),
));
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to recurse here to handle cases like:

def bad():
    try:
        process()
    except MyException:
        if True:
            raise MainFunctionFailed()

This came up in another PR -- here's my explanation: #2073 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

(Otherwise, looks good!)

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Thanks! Think we just need to expand the logic to recurse over the statements.

@charliermarsh
Copy link
Member

Looks good, I'm gonna rebase then merge.

@charliermarsh charliermarsh merged commit d65ce63 into astral-sh:main Jan 23, 2023
@charliermarsh charliermarsh self-requested a review January 23, 2023 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants