Skip to content

Commit

Permalink
chore: add pre-commit hooks (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amnah199 authored Jul 1, 2024
1 parent 3ab2ca5 commit df88e3e
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast # checks Python syntax
- id: check-json # checks JSON syntax
- id: check-merge-conflict # checks for no merge conflict strings
- id: check-shebang-scripts-are-executable # checks all shell scripts have executable permissions
- id: check-toml # checks TOML syntax
- id: check-yaml # checks YAML syntax
- id: end-of-file-fixer # checks there is a newline at the end of the file
- id: mixed-line-ending # normalizes line endings
- id: no-commit-to-branch # prevents committing to main
- id: trailing-whitespace # trims trailing whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
hooks:
- id: ruff
- id: ruff-format

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
additional_dependencies:
- tomli

- repo: https://github.com/rhysd/actionlint
rev: v1.6.25
hooks:
- id: actionlint-docker
args: ["-ignore", "SC2102"]
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Homepage = "https://github.com/deepset-ai/haystack-experimental"

[tool.hatch.envs.default]
dependencies = [
# Pre-commit hook
"pre-commit",
# Type check
"mypy",
# Test
Expand Down Expand Up @@ -103,6 +105,51 @@ max-line-length = 120
disable = [
"C0114", # missing-module-docstring
"R0903", # too-few-public-methods
# To keep
"fixme",
"c-extension-no-member",

# To review:
"missing-docstring",
"unused-argument",
"no-member",
"line-too-long",
"protected-access",
"too-few-public-methods",
"raise-missing-from",
"invalid-name",
"duplicate-code",
"arguments-differ",
"consider-using-f-string",
"no-else-return",
"attribute-defined-outside-init",
"super-with-arguments",
"redefined-builtin",
"abstract-method",
"unspecified-encoding",
"unidiomatic-typecheck",
"no-name-in-module",
"consider-using-with",
"redefined-outer-name",
"arguments-renamed",
"unnecessary-pass",
"broad-except",
"unnecessary-comprehension",
"subprocess-run-check",
"singleton-comparison",
"consider-iterating-dictionary",
"undefined-loop-variable",
"consider-using-in",
"bare-except",
"unexpected-keyword-arg",
"simplifiable-if-expression",
"use-list-literal",
"broad-exception-raised",

# To review later
"cyclic-import",
"import-outside-toplevel",
"deprecated-method",
]

[tool.pytest.ini_options]
Expand Down

0 comments on commit df88e3e

Please sign in to comment.