Skip to content

Commit

Permalink
Add numpydoc validation to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
larrybradley committed Aug 9, 2024
1 parent 3368a4d commit fbe2f44
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ repos:
rev: "v0.4.7"
hooks:
- id: ruff
# args: ["--fix", "--show-fixes"]
args: ["--show-fixes"]
args: ["--fix", "--show-fixes"]

- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
Expand Down Expand Up @@ -102,6 +101,11 @@ repos:
additional_dependencies:
- tomli

- repo: https://github.com/numpy/numpydoc
rev: v1.8.0rc2
hooks:
- id: numpydoc-validation

- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
Expand Down
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,28 @@ exclude_dirs = ['*/tests/test_casa_mask.py']
[tool.bandit.assert_used]
skips = ['*_test.py', '*/test_*.py', '*/tests/helpers.py']

[tool.numpydoc_validation]
checks = [
'all', # report on all checks, except the below
'ES01', # missing extended summary
'EX01', # missing "Examples"
'GL08', # missing docstring
'SA01', # missing "See Also"
'SA04', # missing "See Also" description
'RT02', # only type in "Returns" section (no name)
'SS06', # single-line summary
'RT01', # do not require return type for lazy properties
]

# don't report on objects that match any of these regex;
# remember to use single quotes for regex in TOML
exclude = [
'\._.*', # private functions/methods
'^test_*', # test code
'^conftest.*$', # pytest configuration
'^helpers.*$', # helper modules
]

[tool.docformatter]
wrap-summaries = 72
pre-summary-newline = true
Expand Down

0 comments on commit fbe2f44

Please sign in to comment.