Skip to content

pyproject.toml config ignored with pre-commit hook #646

@emrynHofmannElephant

Description

@emrynHofmannElephant

Hi,

I've tried adding the example to my pyproject.toml:

[tool.numpydoc_validation]
checks = [
    "all",  # report on all checks, except the below
    "EX01", # "No extended summary found"
    "SA01", # "See Also section not found"
    "ES01", # "No examples section found"
]
exclude = [ # don't report on objects that match any of these regex
    '\.undocumented_method$',
    '\.__repr__$',
]
exclude_files = [ # don't process filepaths that match these regex
    '^tests/.*',
    '^tests/**/.*',
    '.*/test_.*',
    '.*\.py',
    '^module/gui.*',
]

Even adding regexes like '.*\.py' to exclude all python files (trying to debug this problem). But even with that, it's running on all python files.

Here is the numpydoc section in my .pre-commit-config.yaml:

# Docstrings
  - repo: https://github.com/numpy/numpydoc
    rev: v1.9.0
    hooks:
      - id: numpydoc-validation

When I run the pre-commit hooks uv run pre-commit run --all-files
I get, for example:

numpydoc-validation......................................................Failed
- hook id: numpydoc-validation
- exit code: 1

tests/conftest.py:1: GL08 The object does not have a docstring

How can I get it to filter to the regexes being passed in the pyproject.toml?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions