haystack/.pre-commit-config.yaml
Sara Zan 2d65c380f1
pre-commit hooks (#2819)
* Add pre-commit config

* update contributing guidelines

* try failing the workflow

* add pre-commit to the deps

* updating uninstall instructions

* separate jobs in CI

* make tutorials check fail

* make black check fail

* make openapi check fail

* make yaml schema and api docs checks fail

* highlight the instructions

* Update .pre-commit-config.yaml

Co-authored-by: Tobias Wochinger <mail@tobias-wochinger.de>

* Update CONTRIBUTING.md

Co-authored-by: Tobias Wochinger <mail@tobias-wochinger.de>

* Update CONTRIBUTING.md

Co-authored-by: Tobias Wochinger <mail@tobias-wochinger.de>

* Use black --check

* Add images of the CI

* title level

* feedback

Co-authored-by: Tobias Wochinger <mail@tobias-wochinger.de>
2022-07-26 15:02:15 +02:00

40 lines
1.3 KiB
YAML

default_language_version:
python: python3.7
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-ast # checks Python syntax
- id: check-json # checks JSON syntax
- id: check-yaml # checks YAML syntax
- id: check-toml # checks TOML syntax
- id: end-of-file-fixer # checks there is a newline at the end of the file
- id: trailing-whitespace # trims trailing whitespace
- id: check-merge-conflict # checks for no merge conflict strings
- id: check-shebang-scripts-are-executable # checks all shell scripts have executable permissions
- id: mixed-line-ending # normalizes line endings
- id: no-commit-to-branch # prevents committing to master
- id: pretty-format-json # indents and sorts JSON files
- repo: https://github.com/psf/black
rev: 22.6.0 # IMPORTANT: keep this aligned with the black version in setup.cfg
hooks:
- id: black
# These can fail if some dependencies are missing. Also untested on Windows.
- repo: local
hooks:
- id: pydoc-markdown
name: Update API documentation (slow)
entry: .github/utils/pydoc-markdown.sh
language: script
types: [bash]
pass_filenames: false
always_run: true
# TODO we can make mypy and pylint run at this stage too, once their execution gets normalized