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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
# See CONTRIBUTING.rst, we expect this to be run via a git pre-commit hook.
# You can also run the checks directly at the terminal, e.g.
#
# $ pre-commit run --all-files
#
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-executables-have-shebangs
files: \.(py|sh)$
- id: check-json
- id: end-of-file-fixer
files: \.py$
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
hooks:
# Run the Ruff linter.
- id: ruff
args: [
'--fix',
'--extend-select=B,C4,D,ISC,UP',
'--extend-ignore=E501,F401,F841,D105,D2,D4',
'--extend-ignore=B007,B009,B010,B018,B028,B904,UP031',
'--extend-per-file-ignores=Tests/*.py:D101,Tests/*.py:D102,Tests/*.py:D103',
'--extend-per-file-ignores=Tests/*.py:B015',
'--config=lint.isort.force-single-line=true',
'--config=lint.isort.order-by-type=false',
]
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
args: [--check,--target-version,py39]
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies: [
'flake8-rst-docstrings>=0.2.3',
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
# equivalent to "files" in .mypy.ini
files: '^(Bio|BioSQL)/'
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [black==24.2.0]
exclude: ^.github/
- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.4
hooks:
- id: rstcheck
args: [
'--ignore-roles=ref,numref,py:mod',
--ignore-directives=toctree,
--ignore-substitutions=version,
--report-level=warning,
--ignore-messages=Unknown\ target\ name
]
- repo: https://github.com/PyCQA/doc8
rev: v1.1.2
hooks:
- id: doc8
additional_dependencies: [pygments]
args: [
--quiet,
--ignore-path=Doc/examples/ec_*.txt,
'--ignore=D000,D001,D002,D004'
]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
files: \.(rst|md)$
args: [
--ignore-regex,
'(^|\W)([A-Z]{2,3})(\W|$)',
-L,
'ser,hsa,hist,fpr,blosum,ags,manuel,mian,fallin'
]
- repo: local
hooks:
- id: doi-link-style
name: Enforce https://doi.org/ style
description: Check DOI link style, see https://www.crossref.org/display-guidelines/
entry: '(?i)(doi:|dx\.doi\.org|http://doi\.org)'
language: pygrep
files: \.(rst|tex)$
- id: contrib-sort
name: Contributor sorting
description: Confirms alphabetical sorting of the CONTRIB.rst file
entry: bash -c 'for n in $(seq 0 "$#"); do grep "^- " "${!n}" | LC_ALL=C sort -u -c -f; done'
#entry: 'grep "^- " CONTRIB.rst | LC_ALL=C sort -u -c -f'
language: system
files: ^CONTRIB\.rst$
ci:
# Settings for the https://pre-commit.ci/ continuous integration service
autofix_prs: true
# Default message is more verbose
autoupdate_commit_msg: '[pre-commit.ci] autoupdate'
# Default is weekly
autoupdate_schedule: quarterly
# Currently pre-commit.ci checks all files, and all hooks takes too long
# and causes a timeout - so as a short-term workaround, skip flake8 etc:
skip: [
check-json,
mixed-line-ending,
flake8,
rstcheck,
doc8,
codespell,
doi-link-style
]
|