Add pre-commit hook and use in CI.

This commit is contained in:
David Wobrock authored and David Wobrock committed 2022-12-26 16:26:24 +01:00
1 parent 2ee7dac3b3
commit f86e0622a5
6 files changed
+51 -25

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: forbid-submodules
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args:
- "--max-line-length=88"
exclude: ^tests/
- repo: https://github.com/pycqa/isort
rev: 5.11.4
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
hooks:
- id: mypy
additional_dependencies:
- types-toml==0.10.8.1
args:
- "--ignore-missing-imports"
exclude: ^tests/
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.194
hooks:
- id: ruff
args:
- "--line-length=88"
exclude: ^tests/
+2 -1
View File
@@ -11,7 +11,8 @@ The crash is a sign to double-check the migration. But if you are certain the mi
- Drop support for Django 2.2
- Internally rename "migration tests" to "migration checks"
- Add dataclasses internally instead of custom dicts
- Add type checking using `mypy`
- Use pre-commit hooks instead for linting
- Add type checking using `mypy` and `ruff`
## 4.1.0
-1
View File
@@ -6,4 +6,3 @@ A small note on how the linter is usually published to PyPi:
- `pip install wheel twine`
- `python3 setup.py sdist bdist_wheel --universal`
- `twine upload dist/django_migration_linter-X.Y.Z-py3-none-any.whl dist/django-migration-linter-X.Y.Z.tar.gz`
-6
View File
@@ -1,6 +0,0 @@
flake8==6.0.0
black==22.12.0
isort==5.11.4
mypy==0.991
types-toml==0.10.8.1
ruff==0.0.194
-9
View File
@@ -1,9 +1,3 @@
[flake8]
max-line-length = 88
[ruff]
line-length = 88
[isort]
multi_line_output = 3
include_trailing_comma = True
@@ -13,6 +7,3 @@ ensure_newline_before_comments = True
line_length = 88
add_imports =
from __future__ import annotations
[mypy]
ignore_missing_imports = True
+2 -8
View File
@@ -26,14 +26,8 @@ deps =
[testenv:lint]
basepython = python3.10
deps =
-r requirements/dev.txt
commands =
flake8 django_migration_linter/
black --check django_migration_linter/ tests/ manage.py setup.py
isort --check-only .
mypy django_migration_linter/
ruff django_migration_linter/
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure
[testenv:coverage]
commands =