diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 13f8e2c..c1c8b85 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1aa3f4c..d16170d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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 diff --git a/README.md b/README.md index 899cd4b..d061656 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/compose.yml b/compose.yml index fc65ac7..18cf4cb 100644 --- a/compose.yml +++ b/compose.yml @@ -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 diff --git a/requirements.txt b/requirements.txt index c31c519..475c4f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -black pre-commit unittest-xml-reporting diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..584afff --- /dev/null +++ b/ruff.toml @@ -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", +]