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
1 change: 0 additions & 1 deletion .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
echo OS: ${{ matrix.os }}
echo Python: ${{ env.PYTHON_VERSION }}
echo Minimal Python version: ${{ env.MIN_PYTHON_VERSION }}
echo Black: ${{ env.BLACK_VERSION }}
echo Flake8: ${{ env.FLAKE8_VERSION }}
echo Pylint: ${{ env.PYLINT_VERSION }}
echo Bandit: ${{ env.BANDIT_VERSION }}
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ and try again. If you are not sure what to do, let others know in a pull
request comment.

Note that there are some steps you can do locally to improve your code.
For Python, run `black .` to apply standardized formatting. You can
also run linter tools such as Pylint which will suggest different improvements
to your code.
For Python, run `ruff format` to apply standardized formatting. You can
also run linter tools such as `ruff check` or Pylint which will suggest
different improvements to your code.

## Compilation

Expand Down
20 changes: 9 additions & 11 deletions doc/development/style_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,25 @@ with PEP8, consistent formatting, and readable and error-free code:

- [Flake8](https://flake8.pycqa.org/en/latest/) tool to ensure compliance with
PEP8
- [Black](https://black.readthedocs.io/en/stable/) code formatter to ensure
consistent code formatting
- [Ruff](https://docs.astral.sh/ruff/) linter and code formatter to ensure
code quality and consistent code formatting
- [Pylint](https://pylint.readthedocs.io/en/latest/) static code analyser to
find bad code practices or errors

Note that while the entire GRASS code base is Black formatted, full compliance
with PEP8, Flake8, and Pylint practices is still work in progress.
Note that while the entire GRASS code base is formatted with `ruff format`,
full compliance with PEP8, Flake8, and Pylint practices is still work in progress.

See [using pre-commit](#using-pre-commit) for pre-commit setup and usage to
simplify performing of these checks.

#### Black
#### Formatting

Use Black to format files:
Use Ruff's formatter to format files:

```bash
black {source_file_or_directory}
ruff format
```

Black is configured via [pyproject.toml](../../pyproject.toml). The line
length is set to 88 characters.

#### Flake8

Use Flake8 to check formatting and basic issues in all files:
Expand Down Expand Up @@ -157,8 +154,9 @@ In that case review the changes and run again `git add` and
It is also possible to run pre-commit manually, e.g:

```bash
pre-commit run --all-files
pre-commit run clang-format --all-files
pre-commit run black --all-files
pre-commit run ruff-format --all-files
```

Or to target a specific set of files:
Expand Down
Loading