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

enable error messages to display function names #8

Closed
rathaustreppe opened this issue Aug 13, 2020 · 0 comments · Fixed by #9
Closed

enable error messages to display function names #8

rathaustreppe opened this issue Aug 13, 2020 · 0 comments · Fixed by #9
Assignees
Labels
enhancement New feature or request

Comments

@rathaustreppe
Copy link

Heyho,
I tried to use your pedantic_class decorator on a class with alot of methods and documentation.
Somewhere in this class in a docstring syntax error. But I cant find it because the error messages doesnt show any function name or text snipped or line of code.

Example of a class containing two function. One with a correct docstring syntax and one without. But of course, in a larger class it is a miracle to find the syntax error - or you have to check every method with pedantic :(

from pedantic import pedantic_class
@pedantic_class
class Foo:
    def __init__(self, a: int) -> None:
        self.a = int
    def func(self, b:str) -> str:
        """
        Function with docstring syntax error below.
        Args:
            b (str):
            simple string
        Returns:
            str: simple string
        """
        return b
    def bunk(self) -> int:
        '''
        Function with correct docstring.
        Returns:
            int: 42
        '''
        return 42

if __name__ == '__main__':
    foo = Foo(a=10)
    foo.func(b='bar')

The error log is quite large. I only copy the featureless last lines:

File "...\lib\site-packages\docstring_parser\google.py", line 106, in _build_meta
    before, desc = text.split(":", 1)
ValueError: not enough values to unpack (expected 2, got 1)
@LostInDarkMath LostInDarkMath self-assigned this Aug 13, 2020
@LostInDarkMath LostInDarkMath added the enhancement New feature or request label Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants