chia-blockchain/.pre-commit-config.yaml

65 lines
2.1 KiB
YAML
Raw Normal View History

repos:
tests|github|pre-commit: Improve `build-workflows.py` and make it a `pre-commit` hook (#8728) * tests: Move `default_replacements` into `generate_replacements` * tests: Directly use `root_test_dirs` Instead of passing it into `subdirs` * tests: Make `build-workflow.py` callable from everywhere * tests: Adjust the output of `build-workflows.py` * tests: Add `-f` to `build-workflows.py` to allow failing on CI * github: Run `build-workflows.py` * pre-commit: Run `build-workflows.py` as first hook * tests: Skip DID wallet tests until they are reliable and fixed * tests: Skip `test_using_legacy_cryptfilekeyring` * tests|github: Drop `root_test_dirs` and just search in all directories This removes the requirement to add new test directories to the `testconfig.py`. This change uncovered two more tests which were not enabled on CI because their parent dir's were not added to `root_test_dirs`. - `tests/weight_proof/test_weight_proof.py` - `tests/util/test_struct_stream.py` * tests|github: Don't list test files, use `tests/dir/tests_*.py` instead * test: Improve workflow update checks by comparing old vs new Instead of doing a `git diff` which can lead to false positives if there are other local changes unlrelated to test workflows. This also fixes the issue that newly added files were not tracked by `git diff` which means the script / the CI would trigger an alert. * tests: Adjust `build-workflows.py` to work as expected on windows * tests: Read/Write in bytes to avoid and detect unexpected `\r\n` * tests: Skip `test_pool_cmdline.py`
2021-11-09 21:57:40 +03:00
- repo: local
hooks:
- id: build-workflows
name: Validate github action workflows
entry: ./tests/build-workflows.py --fail-on-update
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]
# The following, commented hook is the usual way to add isort. However, it doesn't work in some environments.
# See https://github.com/PyCQA/isort/issues/1874#issuecomment-1002212936
# -----------------------------------------------------
# - repo: https://github.com/pycqa/isort
# rev: 5.9.3
# hooks:
# - id: isort
# -----------------------------------------------------
# The hook below is the workaround for the issue above.
- repo: local
hooks:
- id: isort
name: isort
entry: isort
require_serial: true
language: python
language_version: python3
types_or: [cython, pyi, python]
args: ['--filter-files']
minimum_pre_commit_version: '2.9.2'
additional_dependencies: [isort==5.10.1]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-yaml
- id: end-of-file-fixer
exclude: ".*?(.hex|.clvm|.clib)"
- id: trailing-whitespace
- id: check-merge-conflict
- id: check-ast
- id: debug-statements
- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
2022-03-17 18:44:28 +03:00
rev: v0.941
hooks:
- id: mypy
additional_dependencies: [filelock, pytest, pytest-asyncio, types-aiofiles, types-click, types-setuptools, types-PyYAML]
# This intentionally counters the settings in mypy.ini to allow a loose local
# check and a strict CI check. This difference may or may not be retained long
# term.
args: [--no-warn-unused-ignores]