Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Adds numpydoc-validation to pre-commit hooks #40

Merged
merged 4 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ns-rse/39-numpydoc-validation : linting docstrings
09c44841ba185de7ed4729fbe6b1d0f58caeb4bc
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ repos:
hooks:
- id: nbstripout

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

- repo: local
hooks:
- id: pylint
Expand Down
38 changes: 29 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,26 @@ exclude = [
# per-file-ignores = []
line-length = 120
target-version = "py310"
select = ["A", "B", "C", "D", "E", "F", "PT", "PTH", "R", "S", "W", "U"]
ignore = [
lint.select = ["A", "B", "C", "D", "E", "F", "PT", "PTH", "R", "S", "W", "U"]
lint.ignore = [
"B905",
"E501",
"S101",
"T201"]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "PT", "PTH", "R", "S", "W", "U"]
unfixable = []
lint.fixable = ["A", "B", "C", "D", "E", "F", "PT", "PTH", "R", "S", "W", "U"]
lint.unfixable = []

[tool.ruff.flake8-quotes]
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "double"

[tool.ruff.isort]
[tool.ruff.lint.isort]
case-sensitive = true

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.flake8-pytest-style]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = true

[tool.coverage.run]
Expand All @@ -141,4 +141,24 @@ omit = [
"topofileformats/_version.py",
"*tests*",
"**/__init__*",
]
]

[tool.numpydoc_validation]
checks = [
"all", # Perform all check except those listed below
"ES01",
"EX01",
"PR10", # Conflicts with black formatting
"SA01",
]
exclude = [ # don't report on objects that match any of these regex
"\\.undocumented_method$",
"\\.__repr__$",
"^test_",
"^conftest",
]
override_SS05 = [ # override SS05 to allow docstrings starting with these words
"^Process ",
"^Assess ",
"^Access ",
]
Loading
Loading