|
20 | 20 | - [API Documentation](#api-documentation) |
21 | 21 | - [Audit logging](#audit-logging) |
22 | 22 | - [Keeping Python requirements up to date](#keeping-python-requirements-up-to-date) |
23 | | -- [Code linting & formatting](#code-linting--formatting) |
24 | | -- [Pre-commit hooks](#pre-commit-hooks) |
| 23 | +- [Code format](#code-format) |
| 24 | +- [Commit message format](#commit-message-format) |
25 | 25 | - [Issues board](#issues-board) |
26 | 26 | - [Maintaining](#maintaining) |
27 | 27 | - [Enrolment reports](#enrolment-reports) |
@@ -450,36 +450,29 @@ The GraphQL query/mutation and admin site views can be logged by using the mixin |
450 | 450 |
|
451 | 451 | - `pip-sync requirements.txt` |
452 | 452 |
|
453 | | -## Code linting & formatting |
| 453 | +## Code format |
454 | 454 |
|
455 | | -This project uses [ruff](https://github.com/astral-sh/ruff) for Python code linting and formatting. |
456 | | -Ruff is configured through [pyproject.toml](./pyproject.toml). |
457 | | -Basic `ruff` commands: |
458 | | - |
459 | | -- Check linting: `ruff check` |
460 | | -- Check & auto-fix linting: `ruff check --fix` |
461 | | -- Format: `ruff format` |
| 455 | +This project uses [Ruff](https://docs.astral.sh/ruff/) for code formatting and quality checking. |
462 | 456 |
|
463 | | -Basically: |
464 | | - - Ruff linter (i.e. `ruff check --fix`) does what `flake8` and `isort` did before. |
465 | | - - Ruff formatter (i.e. `ruff format`) does what `black` did before. |
| 457 | +Basic `ruff` commands: |
466 | 458 |
|
467 | | -Integrations for `ruff` are available for many editors: |
468 | | - - https://docs.astral.sh/ruff/integrations/ |
| 459 | +* lint: `ruff check` |
| 460 | +* apply safe lint fixes: `ruff check --fix` |
| 461 | +* check formatting: `ruff format --check` |
| 462 | +* format: `ruff format` |
469 | 463 |
|
470 | | -## Pre-commit hooks |
| 464 | +[`pre-commit`](https://pre-commit.com/) can be used to install and |
| 465 | +run all the formatting tools as git hooks automatically before a |
| 466 | +commit. |
471 | 467 |
|
472 | | -You can use [`pre-commit`](https://pre-commit.com/) to lint and format your code before committing: |
| 468 | +## Commit message format |
473 | 469 |
|
474 | | -1. Install `pre-commit` (there are many ways to do that, but let's use pip as an example): |
475 | | - - `pip install pre-commit` |
476 | | -2. Set up git hooks from `.pre-commit-config.yaml` by running these commands from project root: |
477 | | - - `pre-commit install` to enable pre-commit code formatting & linting |
478 | | - - `pre-commit install --hook-type commit-msg` to enable pre-commit commit message linting |
| 470 | +New commit messages must adhere to the [Conventional Commits](https://www.conventionalcommits.org/) |
| 471 | +specification, and line length is limited to 72 characters. |
479 | 472 |
|
480 | | -After that, linting and formatting hooks will run against all changed files before committing. |
| 473 | +When [`pre-commit`](https://pre-commit.com/) is in use, [`commitlint`](https://github.com/conventional-changelog/commitlint) |
| 474 | +checks new commit messages for the correct format. |
481 | 475 |
|
482 | | -Git commit message linting is configured in [.gitlint](./.gitlint) |
483 | 476 |
|
484 | 477 | ## Issues board |
485 | 478 |
|
|
0 commit comments