Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

D417 not raised for missing parameter when section name does not match #461

Open
FelixS90 opened this issue Mar 24, 2020 · 0 comments
Open

Comments

@FelixS90
Copy link

FelixS90 commented Mar 24, 2020

The following example (1) does not raise a D417:

def foo(a: int, b: str) -> None:
    """Does something.

    Parameter
    ----------
    a1
        lala
    b
        foo

    """
    print(a)

The following example (2) properly raises a D417:

def foo(a: int, b: str) -> None:
    """Does something.

    Parameters
    ----------
    a1
        lala
    b
        foo

    """
    print(a)

Note the s appended to the Parameter section.

Content of setup.cfg

[pydocstyle]
convention=numpy
add_select=D417

Expected behaviour
I expect the first example to raise a D417 or to raise an error stating that the section does not comply to numpy format.

Related issues
#406
#319
#459

Notes
The observed behaviour is obviously related to the way pydocstyle is designed. In checker.py, concretely in def check_docstring_sections method, it is not known anymore which convention has been chosen (similar to that error codes to check for are not known, but only evaluated once ConventionChecker().check_source(source, filename,ignore_decorators) has been completed.).

Because of that, it is currently not possible to check for required sections and since D417 is only raised by the _check_parameters_section (numpy) or the _check_args_section (google), which however are not called if none of the possible sections is provided (see example 1), _check_missing_args will not be called. This is also related to #394 and its associated PR #407.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants