1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
repos:
# Syntax validation and some basic sanity checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-merge-conflict
- id: check-ast
fail_fast: True
- id: check-json
- id: check-added-large-files
args: ['--maxkb=200']
- id: check-yaml
# Automatically sort imports
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
args: [
'-a', 'from __future__ import annotations', # 3.7-3.11
'--rm', 'from __future__ import absolute_import', # -3.0
'--rm', 'from __future__ import division', # -3.0
'--rm', 'from __future__ import generator_stop', # -3.7
'--rm', 'from __future__ import generators', # -2.3
'--rm', 'from __future__ import nested_scopes', # -2.2
'--rm', 'from __future__ import print_function', # -3.0
'--rm', 'from __future__ import unicode_literals', # -3.0
'--rm', 'from __future__ import with_statement', # -2.6
]
# Automatic source code formatting
- repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black
args: [--safe, --quiet]
# Linting
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: ['flake8-comprehensions==3.8.0']
# Type checking
# Remember to change versions in .azure-pipelines/azure-pipelines.yml to match
# the versions here.
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.931
hooks:
- id: mypy
files: 'dials_data/.*\.py$'
additional_dependencies: ['types-PyYAML==6.0.4', 'types-requests==2.27.11']
|