From 4a854c36ccae0e463ad202238109ccf664c0a6e9 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sun, 1 Sep 2024 18:31:29 +0200 Subject: [PATCH] refactor: improve pre-commit hooks --- .pre-commit-config.yaml | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cff5a4c6..be0e1d56 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,11 +4,37 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.2.0 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - id: check-yaml + name: Check YAML file formatting - id: check-added-large-files + name: No large Files + description: Checks that you did not unconsciously upload some enormous file + - id: check-ast + name: Check Valid Python + description: check if python file is valid + - id: end-of-file-fixer + name: End of File Fix + description: Checks file ends on newline - id: no-commit-to-branch + name: No direct commit to main + args: ['--branch', 'main'] + description: Do not commit to main directly + - id: trailing-whitespace + name: Trim trailing whitespaces + description: Trailing whitespaces are trimmed +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.4 + hooks: + - id: ruff + args: ["--ignore=E402"] # Ignore E402 error "Module level import not at top of file" + description: python linter + - id: ruff-format + description: python formatter +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.3.0 + hooks: + - id: black-jupyter + description: formating ipynb notebook - repo: https://gitlab.com/daverona/pre-commit/cpp rev: 0.8.0 hooks: @@ -16,14 +42,7 @@ repos: args: [--linelength=100, "--filter=-runtime/references,-readability/braces,-build/include,-build/c++11"] types_or: [c, c++, cuda] - repo: https://github.com/compilerla/conventional-pre-commit - rev: v3.2.0 + rev: v3.4.0 hooks: - id: conventional-pre-commit stages: [commit-msg] - args: [] -- repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.4 # Ruff version. - hooks: - - id: ruff # Run the linter for Python. - args: ["--ignore=E402"] # Ignore E402 error "Module level import not at top of file" - - id: ruff-format # Run the formatter for Python.