Skip to content

Commit

Permalink
Unpin docformatter 1.5.1 (#2538)
Browse files Browse the repository at this point in the history
* Unpin docformatter 1.5.1

Docformatter=1.7.0 has a `--black` option to make it compatible with the black linter. Also updated a few docstrings in the unit test where docformatter tried to capitalize the first letter.

* Lint with docformatter=1.7.2

Shorten some docstrings to remove whitespace.

* Bump minimum docformatter version to 1.7.2 in environment.yml

Skip docformatter=1.7.1 as it was a bit buggy, see docformatter=1.7.2 release notes at https://github.com/PyCQA/docformatter/releases/tag/v1.7.2.
  • Loading branch information
weiji14 authored Jun 7, 2023
1 parent 7404011 commit 6c69fb6
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/format-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
# Install formatting tools
- name: Install formatting tools
run: |
python -m pip install black blackdoc docformatter==1.5.1 flakeheaven isort
python -m pip install black blackdoc docformatter flakeheaven isort
sudo apt-get install dos2unix
# Run "make format" and commit the change to the PR branch
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/style_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Install packages
run: |
python -m pip install black blackdoc docformatter==1.5.1 flakeheaven pylint isort
python -m pip install black blackdoc docformatter flakeheaven pylint isort
sudo apt-get install dos2unix
- name: Formatting check (black, blackdoc, docformatter, flakeheaven and isort)
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
# Dev dependencies (style checks)
- black
- blackdoc
- docformatter>=1.5.0,<1.6.0
- docformatter>=1.7.2
- flakeheaven>=3
- isort>=5
- pylint
Expand Down
4 changes: 2 additions & 2 deletions pygmt/tests/test_grdcut.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def fixture_expected_grid():

def test_grdcut_dataarray_in_file_out(grid, expected_grid, region):
"""
grdcut an input DataArray, and output to a grid file.
Test grdcut on an input DataArray, and output to a grid file.
"""
with GMTTempFile(suffix=".nc") as tmpfile:
result = grdcut(grid, outgrid=tmpfile.name, region=region)
Expand All @@ -55,7 +55,7 @@ def test_grdcut_dataarray_in_file_out(grid, expected_grid, region):

def test_grdcut_dataarray_in_dataarray_out(grid, expected_grid, region):
"""
grdcut an input DataArray, and output as DataArray.
Test grdcut on an input DataArray, and output as DataArray.
"""
outgrid = grdcut(grid, region=region)
assert isinstance(outgrid, xr.DataArray)
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_grdproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def fixture_expected_grid():

def test_grdproject_file_out(grid, expected_grid):
"""
grdproject with an outgrid set.
Test grdproject with an outgrid set.
"""
with GMTTempFile(suffix=".nc") as tmpfile:
result = grdproject(
Expand Down
8 changes: 4 additions & 4 deletions pygmt/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@ def test_plot_lines_with_arrows():
"""
Plot lines with arrows.
The test is slightly different from test_plot_vectors().
Here the vectors are plotted as lines, with arrows at the end.
The test is slightly different from test_plot_vectors(). Here the vectors
are plotted as lines, with arrows at the end.
The test also checks if the API crashes.
See https://github.com/GenericMappingTools/pygmt/issues/406.
The test also checks if the API crashes. See
https://github.com/GenericMappingTools/pygmt/issues/406.
"""
fig = Figure()
fig.basemap(region=[-2, 2, -2, 2], frame=True)
Expand Down
6 changes: 2 additions & 4 deletions pygmt/tests/test_plot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def fixture_region():
@pytest.mark.mpl_image_compare
def test_plot3d_red_circles_zscale(data, region):
"""
Plot the 3-D data in red circles passing in vectors and setting
zscale = 5
Plot the 3-D data in red circles passing in vectors and setting zscale=5.
"""
fig = Figure()
fig.plot3d(
Expand All @@ -55,8 +54,7 @@ def test_plot3d_red_circles_zscale(data, region):
@pytest.mark.mpl_image_compare
def test_plot3d_red_circles_zsize(data, region):
"""
Plot the 3-D data in red circles passing in vectors and setting
zsize = "6c"
Plot the 3-D data in red circles passing in vectors and setting zsize="6c".
"""
fig = Figure()
fig.plot3d(
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_psconvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def test_psconvert():
"""
psconvert creates a figure in the current directory.
Check that psconvert creates a figure in the current directory.
"""
fig = Figure()
fig.basemap(region="10/70/-3/8", projection="X4i/3i", frame="a")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ line-length = 79
omit = ["*/tests/*", "*pygmt/__init__.py"]

[tool.docformatter]
black = true
recursive = true
pre-summary-newline = true
make-summary-multi-line = true
Expand Down

0 comments on commit 6c69fb6

Please sign in to comment.