Skip to content

Commit

Permalink
Add black-doc to pre-commit (#4120)
Browse files Browse the repository at this point in the history
* Update .pre-commit-config.yaml

* Update .pre-commit-config.yaml

* add blackdoc length config

* add blackdoc commit to git-blame-ignore-revs

* Apply suggestions from code review

* Update .git-blame-ignore-revs

Co-authored-by: Andras Deak <adeak@users.noreply.github.com>

---------

Co-authored-by: Andras Deak <adeak@users.noreply.github.com>
  • Loading branch information
akaszynski and adeak committed Mar 19, 2023
1 parent bfa5ffb commit 1e84e8e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# enforce unified code style with black
28914fc2236cd5850f536b151d0ef383855d8519
db0691cfb6b033e55664ffba25deb456a386a48c

# enforce unified code style in our documentation with blackdoc
a26a52d037a265774be0ca06bb141e3346e73ad0
635052d1bce8615fcc4879f5f200921a4f78aa1a
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ repos:
hooks:
- id: black

- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
hooks:
- id: blackdoc
files: '\.py$'
exclude: pyvista/plotting/charts.py

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ skip-string-normalization = true
target-version = ['py39']
exclude='\.eggs|\.git|\.mypy_cache|\.tox|\.venv|_build|buck-out|build|dist|node_modules'

[tool.blackdoc]
# From https://numpydoc.readthedocs.io/en/latest/format.html
# Extended discussion: https://github.com/pyvista/pyvista/pull/4129
# The length of docstring lines should be kept to 75 characters to facilitate
# reading the docstrings in text terminals.
line-length = 75

[tool.build_sphinx]
source-dir = 'doc'
build-dir = './doc/_build'
Expand Down
6 changes: 4 additions & 2 deletions pyvista/examples/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -4676,7 +4676,9 @@ def download_fea_hertzian_contact_cylinder(load=True): # pragma: no cover
>>> import pyvista as pv
>>> from pyvista import examples
>>> grid = examples.download_fea_hertzian_contact_cylinder()
>>> grid.plot(scalars='PartID', cmap=['green', 'blue'], show_scalar_bar=False)
>>> grid.plot(
... scalars='PartID', cmap=['green', 'blue'], show_scalar_bar=False
... )
Plot the absolute value of the component stress in the Z direction.
Expand All @@ -4685,7 +4687,7 @@ def download_fea_hertzian_contact_cylinder(load=True): # pragma: no cover
>>> _ = pl.add_mesh(
... grid,
... scalars=z_stress,
... clim=[0, 1.2E9],
... clim=[0, 1.2e9],
... cmap='jet',
... lighting=True,
... show_edges=False,
Expand Down

0 comments on commit 1e84e8e

Please sign in to comment.