Skip to content
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: 1 addition & 1 deletion .github/workflows/format-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# Install formatting tools
- name: Install formatting tools
run: |
pip install black blackdoc docformatter flake8 isort
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
4 changes: 2 additions & 2 deletions .github/workflows/style_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:

- name: Install packages
run: |
pip install black blackdoc docformatter flake8 pylint isort
pip install black blackdoc docformatter flakeheaven pylint isort
sudo apt-get install dos2unix

- name: Formatting check (black, blackdoc, docformatter, flake8 and isort)
- name: Formatting check (black, blackdoc, docformatter, flakeheaven and isort)
run: make check

- name: Linting (pylint)
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BLACK_FILES=$(PROJECT) setup.py doc/conf.py examples
BLACKDOC_OPTIONS=--line-length 79
DOCFORMATTER_FILES=$(PROJECT) setup.py doc/conf.py examples
DOCFORMATTER_OPTIONS=--recursive --pre-summary-newline --make-summary-multi-line --wrap-summaries 79 --wrap-descriptions 79
FLAKE8_FILES=$(PROJECT) setup.py doc/conf.py examples
FLAKEHEAVEN_FILES=$(PROJECT) setup.py doc/conf.py examples
LINT_FILES=$(PROJECT) setup.py doc/conf.py

help:
Expand All @@ -19,7 +19,7 @@ help:
@echo " test run the test suite (including some doctests) and report coverage"
@echo " fulltest run the test suite (including all doctests) and report coverage"
@echo " format run black, blackdoc, docformatter and isort to automatically format the code"
@echo " check run code style and quality checks (black, blackdoc, docformatter, flake8 and isort)"
@echo " check run code style and quality checks (black, blackdoc, docformatter, flakeheaven and isort)"
@echo " lint run pylint for a deeper (and slower) quality check"
@echo " clean clean up build and generated files"
@echo " distclean clean up build and generated files, including project metadata files"
Expand Down Expand Up @@ -64,7 +64,7 @@ check:
docformatter --check $(DOCFORMATTER_OPTIONS) $(DOCFORMATTER_FILES)
black --check $(BLACK_FILES)
blackdoc --check $(BLACKDOC_OPTIONS) $(BLACK_FILES)
flake8 $(FLAKE8_FILES)
FLAKEHEAVEN_CACHE_TIMEOUT=0 flakeheaven lint $(FLAKEHEAVEN_FILES)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FLAKEHEAVEN_CACHE_TIMEOUT cache invalidation flag might not be needed once flakeheaven/flakeheaven#87 is merged into flakeheaven and a new release is made.


lint:
pylint $(LINT_FILES)
Expand Down
4 changes: 2 additions & 2 deletions doc/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,14 +499,14 @@ words bridged only by consonants, such as `distcalc`, and `crossprofile`. This
convention is not applied by the code checking tools, but the PyGMT maintainers
will comment on any pull requests as needed.

We also use [flake8](http://flake8.pycqa.org/en/latest/) and
We also use [flakeheaven](https://flakeheaven.readthedocs.io) and
[pylint](https://pylint.pycqa.org/) to check the quality of the code and quickly catch
common errors.
The [`Makefile`](https://github.com/GenericMappingTools/pygmt/blob/main/Makefile)
contains rules for running both checks:

```bash
make check # Runs black, blackdoc, docformatter, flake8 and isort (in check mode)
make check # Runs black, blackdoc, docformatter, flakeheaven and isort (in check mode)
make lint # Runs pylint, which is a bit slower
```

Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
- black
- blackdoc
- docformatter
- flake8
- flakeheaven>=3
- isort>=5
- pylint
# Dev dependencies (unit testing)
Expand Down
6 changes: 3 additions & 3 deletions examples/gallery/embellishments/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
fig = pygmt.Figure()
fig.basemap(region=[0, 3, 6, 9], projection="x3c", frame=["af", "WSne+tColorbars"])

## Create a colorbar designed for seismic tomography - roma
# Create a colorbar designed for seismic tomography - roma
# Colorbar is placed at bottom center (BC) by default if no position is given
fig.colorbar(cmap="roma", frame=["x+lVelocity", "y+lm/s"])

## Create a colorbar showing the scientific rainbow - batlow
# Create a colorbar showing the scientific rainbow - batlow
fig.colorbar(
cmap="batlow",
# Colorbar positioned at map coordinates (g) longitude/latitude 0.3/8.7,
Expand All @@ -41,7 +41,7 @@
scale=100,
)

## Create a colorbar suitable for surface topography - oleron
# Create a colorbar suitable for surface topography - oleron
fig.colorbar(
cmap="oleron",
# Colorbar position justified outside map frame (J) at Middle Right (MR),
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ fallback_version = "999.999.999+unknown"
[tool.coverage.run]
omit = ["*/tests/*", "*pygmt/__init__.py"]

[tool.flakeheaven]
max_line_length = 88
max_doc_length = 79
show_source = true

[tool.flakeheaven.plugins]
pycodestyle = ["+*", "-E501", "-W503"]
pyflakes = ["+*"]

[tool.flakeheaven.exceptions."**/__init__.py"]
pyflakes = ["-F401"]

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--verbose --durations=0 --durations-min=0.2 --doctest-modules --mpl --mpl-results-path=results"
Expand Down
5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.