terrencepreilly / darglint

A python documentation linter which checks that the docstring description matches the definition.
MIT License
482 stars 41 forks source link

Special character " throws off Darglint #121

Closed JPFrancoia closed 4 years ago

JPFrancoia commented 4 years ago

Hi,

I'm starting to use darglint more and more since its stability greatly improved overtime. However, I think I found a bug. The " character seems to give troubles to darglint:

def dummy_func(date: str, frequency: int) -> pd.DataFrame:
    """Dummy function.

    Args:
        date: date str formatted as "YYYYMMDD"
        frequency: number

    Returns:
        Something

    """
    ...

And I get the errors:

DAR101 Missing parameter(s) in Docstring: - frequency
DAR102 Excess parameter(s) in Docstring: + "frequency

Writing the docstring like this solves all the errors (note that I removed the " around YYYYMMDD):

 """Add columns containing date information to dataframe.

    Args:
        date: date str formatted as YYYYMMDD
        frequency: number

    Returns:
        Something

    """

This isn't a critical bug, but it's unexpected.

Darglint version: darglint==1.5.2

terrencepreilly commented 4 years ago

Yes, I see. Apparently, this is the result of some dead code. (For testing the previous parser, darglint parsed quotation marks, in order to determine where docstrings started and ended.) I've removed the offending code (d2d0f45861cfe7ed8d0a916eca181b144ed77cba), and it should be resolved in v1.5.3, which I'll try to release this weekend.

JPFrancoia commented 4 years ago

Thank you!