Skip to content

Commit

Permalink
Update hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jan 30, 2024
1 parent 4f3495d commit 7a4dcae
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 27 deletions.
60 changes: 36 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,53 @@
exclude: ".yarn/|yarn.lock"
exclude: ".yarn/|yarn.lock|\\.min\\.(css|js)$"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-builtin-literals
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.9.0
rev: 1.15.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: [--profile=black, --lines-after-imports=2, --combine-as]
- repo: https://github.com/psf/black
rev: 22.6.0
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
- id: absolufy-imports
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.7"
hooks:
- id: flake8
args: ["--ignore=E203,E501,W503"]
additional_dependencies:
- flake8-bugbear
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.0
rev: v3.1.0
hooks:
- id: prettier
args: [--list-different, --no-semi, "--trailing-comma=es5"]
args: [--list-different, --no-semi]
exclude: "^conf/|.*\\.html$"
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.54.0
hooks:
- id: eslint
additional_dependencies:
- eslint
- eslint-config-prettier
- "@babel/core"
- "@babel/eslint-parser"
- "@babel/preset-env"
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.5.1
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
hooks:
- id: validate-pyproject
61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[tool.ruff]
extend-select = [
# pyflakes, pycodestyle
"F", "E", "W",
# mmcabe
"C90",
# isort
"I",
# pep8-naming
"N",
# pyupgrade
"UP",
# flake8-2020
"YTT",
# flake8-boolean-trap
"FBT",
# flake8-bugbear
"B",
# flake8-comprehensions
"C4",
# flake8-django
"DJ",
# flake8-implicit-string-concatenation
"ISC",
# flake8-pie
"PIE",
# flake8-simplify
"SIM",
# flake8-gettext
"INT",
# pygrep-hooks
"PGH",
# pylint
"PLC", "PLE", "PLW",
# unused noqa
"RUF100",
]
extend-ignore = [
# Allow zip() without strict=
"B905",
# No line length errors
"E501",
]
fix = true
show-fixes = true
target-version = "py39"

[tool.ruff.isort]
combine-as-imports = true
lines-after-imports = 2

[tool.ruff.mccabe]
max-complexity = 15

[tool.ruff.per-file-ignores]
"*/migrat*/*" = [
# Allow using PascalCase model names in migrations
"N806",
# Ignore the fact that migration files are invalid module names
"N999",
]
2 changes: 1 addition & 1 deletion simple_redirects/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from .models import Redirect
from simple_redirects.models import Redirect


admin.site.register(Redirect, list_display=("old_path", "new_path"))
2 changes: 1 addition & 1 deletion simple_redirects/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.http import HttpResponseRedirect
from django.utils.deprecation import MiddlewareMixin

from .models import Redirect
from simple_redirects.models import Redirect


class RedirectFallbackMiddleware(MiddlewareMixin):
Expand Down
1 change: 0 additions & 1 deletion simple_redirects/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = []

operations = [
Expand Down

0 comments on commit 7a4dcae

Please sign in to comment.