Skip to content

Commit

Permalink
Add numpydoc pre-commit checks (#25)
Browse files Browse the repository at this point in the history
Previously, numpydoc validation checks were running while building the
docs. It seems more intuitive to run them alongside the other linters
now that numpydoc support pre-commit, and results in better/faster
feedback. In addition, this allows us to easily pin the numpydoc version
and automatically update it via pre-commit.ci.

It looks like the latest release of https://github.com/numpy/numpydoc
doesn't yet have a `pre-commit-hooks.yaml` file, so for now we are
pinned to the most recent commit.
  • Loading branch information
gmgunter committed Aug 22, 2023
1 parent 69a91ec commit 02ffb6e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ repos:
hooks:
- id: mypy

- repo: https://github.com/numpy/numpydoc
# The latest stable release doesn't yet support pre-commit.
rev: "6e748efc6b90ff29ddfbc1334c2ac7197ad67858"
hooks:
- id: numpydoc-validation

- repo: https://github.com/hadialqattan/pycln
rev: "v2.2.2"
hooks:
Expand Down
17 changes: 0 additions & 17 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,3 @@
napoleon_include_init_with_doc = True
napoleon_use_admonition_for_notes = True
napoleon_use_rtype = False

# Extension configuration options: `numpydoc`.
numpydoc_validation_checks = {
"all",
"ES01",
"EX01",
"GL01",
"GL08",
"PR01",
"PR09",
"RT02",
"SA01",
"SA04",
"SS02",
"SS05",
"SS06",
}
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ known_first_party = ["tophu"]
python_version = "3.8"
ignore_missing_imports = true

[tool.numpydoc_validation]
checks = [
"all",
"ES01",
"EX01",
"GL01",
"GL08",
"PR01",
"PR09",
"RT01",
"RT02",
"SA01",
"SA04",
"SS02",
"SS05",
"SS06",
]
exclude = ["test"]

[tool.pydocstyle]
ignore = "D100,D102,D104,D105,D203,D204,D212,D413"
ignore-decorators="property"
Expand Down
2 changes: 1 addition & 1 deletion src/tophu/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def __init__(
dtype : data-type
Data-type of the array's elements. Must be convertible to a `numpy.dtype`
object.
kwargs : dict
**kwargs : dict
Additional dataset creation options. These keywords are ignored if a dataset
is not created. See `h5py.Group.create_dataset()` for valid options.
"""
Expand Down

0 comments on commit 02ffb6e

Please sign in to comment.