From 6f58181a6524ae11788e3a505ca8e2e6dea724f0 Mon Sep 17 00:00:00 2001 From: Sandeep Pandey <71967467+7pandeys@users.noreply.github.com> Date: Sun, 10 Dec 2023 18:12:27 +0530 Subject: [PATCH] Add .pre-commit-config.yaml --- .pre-commit-config.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..076f5ee --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,27 @@ +repos: + + # pre-commit checks + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace # Removes extra whitespaces in the code + - id: end-of-file-fixer # Adds empty string at the end of file + - id: check-yaml # Checks structure of all yaml files + - id: detect-private-key # Checks for the presence of private key getting accidentally committed + - id: check-merge-conflict # Checks for the presence of merge conflicts in code files + - id: check-added-large-files # Ensures no large files are committed by default + - id: check-case-conflict # Checks for case-conflicting filenames in codebase + + # black - black code formatter to format the Python code automatically + - repo: https://github.com/psf/black + rev: 23.9.1 + hooks: + - id: black + args: [--line-length=120] + + # ruff - ruff code linting framework + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.287 + hooks: + - id: ruff + args: [ --fix, --exit-non-zero-on-fix, --ignore=E501 ]