From 84fb0e9ab0aeae3621a0cc2a4d50791b3759eaef Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 3 Oct 2022 14:21:42 +0200 Subject: [PATCH] misc: add django-upgrade files/notes (#69798) --- .git-blame-ignore-revs | 2 ++ .pre-commit-config.yaml | 15 ++++++++++----- README | 9 ++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index f4fb7d80..dcd35b01 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -6,3 +6,5 @@ f4615c506194cf4eace0af551f14f54552f09dc5 # misc: apply djhtml (#69709) 4784a3990eec0aadadce99bf1da21c0b531b289d +# misc: apply django-upgrade (#69798) +cd498afcb0bcd8d3f2fce98c9747ca1406d9a449 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ef94dad9..030c42fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,16 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: +- repo: https://github.com/asottile/pyupgrade + rev: v2.20.0 + hooks: + - id: pyupgrade + args: ['--keep-percent-format', '--py37-plus'] +- repo: https://github.com/adamchainz/django-upgrade + rev: 1.10.0 + hooks: + - id: django-upgrade + args: ['--target-version', '2.2'] - repo: https://github.com/psf/black rev: 22.3.0 hooks: @@ -11,11 +21,6 @@ repos: hooks: - id: isort args: ['--profile', 'black', '--line-length', '110'] -- repo: https://github.com/asottile/pyupgrade - rev: v2.20.0 - hooks: - - id: pyupgrade - args: ['--keep-percent-format', '--py37-plus'] - repo: https://github.com/rtts/djhtml rev: 'v1.5.2' hooks: diff --git a/README b/README index 1f18e816..cadd522d 100644 --- a/README +++ b/README @@ -108,9 +108,12 @@ djhtml is used to automatically indent html files, using those parameters: djhtml --tabwidth 2 -There is .pre-commit-config.yaml to use pre-commit to automatically run black, -isort, pyupgrade, and djhtml before commits. (execute `pre-commit install` -to install the git hook.) +django-upgrade is used to automatically upgrade Django syntax, using those parameters: + + django-upgrade --target-version 2.2 + +There is .pre-commit-config.yaml to use pre-commit to automatically run these tools +before commits. (execute `pre-commit install` to install the git hook.) License