Skip to content
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ env:

jobs:
pre-commit:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: pre-commit
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.13'
cache: pip
Expand Down
14 changes: 6 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-builtin-literals
Expand All @@ -26,28 +26,26 @@ repos:
args: [--unique]
files: ^(?:packages|requirements)\.txt$
- id: fix-byte-order-marker
- id: fix-encoding-pragma
args: [--remove]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
rev: v0.14.6
hooks:
- id: ruff
- id: ruff-check
args: [--exit-non-zero-on-fix, --fix]
- id: ruff-format
args: [--check]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
rev: v1.37.1
hooks:
- id: yamllint
args: [--strict]
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
rev: v2.14.0
hooks:
- id: hadolint-docker
name: hadolint
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v0.9.2
rev: v1.16.3
hooks:
- id: zizmor
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,13 @@ in the documentation.

### Linting & Formatting

Django uses the following linting and formatting tools: `black`, `flake8`,
`isort`, and `eslint`. To ensure that the correct versions are used, Django
also supports using `pre-commit` which is the mechanism provided here:
The project uses `pre-commit` to configure and manage lint and formating tools.
Those tools can be invoked using the following command:

```console
$ docker compose run --rm pre-commit
```

You can run individual tools by passing them as an argument:

```console
$ docker compose run --rm pre-commit black
$ docker compose run --rm pre-commit blacken-docs
$ docker compose run --rm pre-commit isort
$ docker compose run --rm pre-commit flake8
$ docker compose run --rm pre-commit eslint # XXX: Currently not working.
```

More information about Django's [coding style][5] can be found in the
documentation.

Expand Down
4 changes: 0 additions & 4 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,6 @@ services:
<<: *base
entrypoint: pre-commit run --all-files
working_dir: /django/source
environment:
# XXX: Disable eslint due to issues finding dependencies.
# See https://github.com/django/django/pull/18162
SKIP: eslint

sphinx:
<<: *base
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
black
pre-commit
unittest-xml-reporting
14 changes: 14 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[lint]
select = [
# https://docs.astral.sh/ruff/rules/#error-e
# https://github.com/PyCQA/pycodestyle
"E4",
"E7",
"E9",
# https://docs.astral.sh/ruff/rules/#pyflakes-f
# https://github.com/PyCQA/pyflakes
"F",
# https://docs.astral.sh/ruff/rules/#pyupgrade-up
# https://github.com/asottile/pyupgrade
"UP",
]