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

pydoclint uses variable instead of exception itself #175

Closed
jsh9 opened this issue Oct 2, 2024 · 8 comments · Fixed by #184
Closed

pydoclint uses variable instead of exception itself #175

jsh9 opened this issue Oct 2, 2024 · 8 comments · Fixed by #184

Comments

@jsh9
Copy link
Owner

jsh9 commented Oct 2, 2024

It was originally reported here: #174 (comment)

Code example (Google style docstring):

def myFunc():
    """
    Do something

    Raises:
        IOError: If something is wrong
    """
    try:
        3 + 3
    except IOError as e:
        raise e

Violation message:

'DOC503: Function `myFunc` exceptions in the "Raises" section in the '
 'docstring do not match those in the function body Raises values in the '
 "docstring: ['IOError']. Raised exceptions in the body: ['e']."

(There should have been no violations.)

@jsh9
Copy link
Owner Author

jsh9 commented Oct 2, 2024

Hi @Amar1729 , could you take a look at this issue and see if there is a fix?

Thanks!

@Amar1729
Copy link
Contributor

Amar1729 commented Oct 2, 2024

hm, thought I had a test for this case. yeah I can take a look.

@jsh9
Copy link
Owner Author

jsh9 commented Oct 20, 2024

Hi @Amar1729 , did you happen to have a chance to check this? Thanks!

@Gnosnay
Copy link

Gnosnay commented Nov 28, 2024

any progress on this? i am willing to help

@jsh9
Copy link
Owner Author

jsh9 commented Nov 28, 2024

Hi @Amar1729 and @Gnosnay , any help is greatly appreciated!

@Amar1729
Copy link
Contributor

Amar1729 commented Dec 8, 2024

@jsh9 i had some unexpected life stuff come up and have been super busy, my bad. just got a chance to look at this, turned out to be a relatively simple fix. Let me know how the PR looks (and of course, if you can think of additional edge cases feel free to add them; clearly there are many related to extracting raised exception names from source code ;))

@jsh9 jsh9 closed this as completed in #184 Dec 14, 2024
@jsh9
Copy link
Owner Author

jsh9 commented Dec 15, 2024

Hi @Amar1729 , thank you so much for making the change!

I can't think of any more edge cases for now, so I merged your current test cases as is.

@jsh9
Copy link
Owner Author

jsh9 commented Dec 15, 2024

The fix is published in 0.5.11.

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 a pull request may close this issue.

3 participants