--- a +++ b/.pre-commit-config.yaml @@ -0,0 +1,80 @@ +default_language_version: + python: python3 + +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + autofix_prs: true + autoupdate_branch: "master" + autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate" + autoupdate_schedule: quarterly + skip: [ ] + submodules: false + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-yaml + - id: check-json + - id: check-executables-have-shebangs + - id: check-toml + - id: check-docstring-first + - id: check-added-large-files + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-case-conflict + - id: mixed-line-ending + - id: end-of-file-fixer + - id: check-case-conflict + - id: forbid-new-submodules + - id: pretty-format-json + args: [ "--autofix", "--no-sort-keys", "--indent=4" ] + + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.9.7 + hooks: + - id: ruff + args: [ "--ignore=E402,E501,F401", "--fix" ] #, --exit-non-zero-on-fix, ] + - id: ruff + name: ruff lint braindecode preview + args: [ "--fix", "--preview", "--select=NPY201" ] + files: ^braindecode/ + - id: ruff + name: ruff lint docs, and examples + # D103: missing docstring in public function + # D400: docstring first line must end with period + args: [ "--ignore=D103,D400,E402", "--fix" ] + files: ^docs/|^examples/ + - id: ruff-format + files: ^braindecode/|^docs/|^examples/ + + + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell + args: + - --ignore-words-list=carin,splitted,meaned,wil,whats,additionals,alle,alot,bund,currenty,datas,farenheit,falsy,fo,haa,hass,iif,incomfort,ines,ist,nam,nd,pres,pullrequests,resset,rime,ser,serie,te,technik,ue,unsecure,withing,zar,mane + - --skip="./.*,*.csv,*.json,*.ambr" + - --quiet-level=2 + exclude_types: [ csv, json ] + exclude: ^tests/|generated/^.github + + - repo: https://github.com/asottile/blacken-docs + rev: 1.19.1 + hooks: + - id: blacken-docs + exclude: ^.github|CONTRIBUTING.md + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.15.0 + hooks: + - id: mypy + files: braindecode/.*.py|test/.*.py|examples/.*.py + additional_dependencies: + [ + types-PyYAML, + types-requests, + ] + verbose: true