jsh9 / pydoclint

A Python docstring linter that checks arguments, returns, yields, and raises sections
https://pypi.org/project/pydoclint/
MIT License
141 stars 15 forks source link

pydoclint uses variable instead of exception itself #175

Open jsh9 opened 2 weeks ago

jsh9 commented 2 weeks ago

It was originally reported here: https://github.com/jsh9/pydoclint/issues/174#issuecomment-2387881545

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 commented 2 weeks ago

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

Thanks!

Amar1729 commented 2 weeks ago

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

jsh9 commented 13 hours ago

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