Skip to content

Widen numpydoc-validation checks beyond PR01/PR02 and beyond .plot methods #898

@drbenvincent

Description

@drbenvincent

Context

numpydoc-validation is currently configured (in pyproject.toml) to enforce only PR01 and PR02, and only on .plot methods (negative-lookahead exclude). That narrow scope was intentional for #886, but the hook can do considerably more across the whole causalpy/ tree.

[tool.numpydoc_validation]
checks = [
    "PR01",  # Parameters not documented
    "PR02",  # Unknown parameters
]
exclude = ['^(?!.*\.plot$).*$']

While addressing #892 it became clear that numpydoc-validation cannot catch the body-level rendering bug we hit there (it doesn't inspect section bodies), but it can catch a number of other defects that currently slip through.

Proposed change

Expand the configured checks to a curated set, then drop the .plot-only exclude so the rules apply package-wide. Candidate rules to add (each can be landed independently to keep the noise manageable):

  • PR04 parameter has no type
  • PR07 parameter has no description
  • PR10 parameter requires a space before the colon
  • RT03 return value has no description
  • SS03 summary does not end with a period
  • GL07 sections in wrong order
  • GL08 object does not have a docstring (note overlap with interrogate; decide whether to keep one or both)

Other rules (SS05 infinitive verb, RT01 no Returns section, EX01 / SA01 / ES01) are likely too noisy to enable globally and should be considered case by case.

Acceptance criteria

  • Each enabled rule is added in a separate commit so violations can be reviewed and fixed in isolation.
  • The exclude regex is removed once the package-wide pass is clean.
  • Configuration in pyproject.toml is updated and documented.

Out of scope

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions