chia-blockchain/.pre-commit-config.yaml
dustinface ec5f85dfc4
mypy: Build mypy.ini config with exclusions dynamically (#15158)
* mypy: Build `mypy.ini` config with exclusions dynamically

* Apply suggestions from code review

* Revert suggested `check=True` because `mypy` is expected to fails here

* Only `read_text` once

* Fix exception message

* Don't `touch`

* More `joinpath`

* Revert `newline="\n"`, its python 3.10 only

See https://bugs.python.org/issue23706

* Apply suggestions

* Fail if new issues get introduced

* Print the newly introduces issues

* Handle error codes

* Add `write_file`

* Use `sys.executable`

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* `mypy_failures[:-1]`

* Add an example comment

* Improve failure check

* Drop exclusions after rebase

* Drop one more exclusion after another rebase

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-05-22 16:50:13 -05:00

72 lines
1.8 KiB
YAML

repos:
- repo: local
hooks:
- id: check-sql
name: Validate SQL statements
entry: python3 -m tests.check_sql_statements
language: python
pass_filenames: false
- repo: local
hooks:
- id: init_py_files
name: __init__.py files
entry: python3 tests/build-init-files.py -v --root .
language: python
pass_filenames: false
additional_dependencies: [click~=7.1]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
- id: mixed-line-ending
args: ["--fix=lf"]
- id: end-of-file-fixer
exclude: ".*?(.hex|.clsp|.clvm|.clib)"
- id: trailing-whitespace
- id: check-merge-conflict
- id: check-ast
- id: debug-statements
- repo: local
hooks:
- id: clvm_hex
name: .clsp.hex files
entry: ./activated.py python tools/manage_clvm.py check
language: python
pass_filenames: false
- repo: local
hooks:
- id: chialispp
name: Pretty print chialisp files
entry: ./activated.py python tools/chialispp.py .
language: python
pass_filenames: false
- repo: local
hooks:
- id: build mypy.ini
name: build mypy.ini
entry: ./activated.py python manage-mypy.py build-mypy-ini
language: system
pass_filenames: false
- repo: local
hooks:
- id: mypy
name: mypy
entry: ./activated.py mypy
language: system
pass_filenames: false
- repo: local
hooks:
- id: isort
name: isort
entry: ./activated.py isort .
language: system
pass_filenames: false
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8