Skip to content

Commit

Permalink
Merge pull request #40 from AFM-SPM/ns-rse/39-numpydoc-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ns-rse authored May 1, 2024
2 parents 4eafdff + 3c045c4 commit 84bfe52
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 114 deletions.
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 @@ -116,26 +116,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 @@ -144,4 +144,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

0 comments on commit 84bfe52

Please sign in to comment.