From 9fd8b1933dc17509bf5c784fe9fd7990f4411381 Mon Sep 17 00:00:00 2001 From: Benedikt Mersch Date: Fri, 20 Sep 2024 14:56:45 +0200 Subject: [PATCH] Add pre-commit --- .github/workflows/pre-commit.yml | 18 ++++++++++++++++++ .pre-commit-config.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..809ea78 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,18 @@ +name: Style Check + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + pre-commit: + name: Pre-commit checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - uses: pre-commit/action@v3.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..214858f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,26 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + exclude: \.patch$ + - id: end-of-file-fixer + exclude: \.patch$ + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: v14.0.0 + hooks: + - id: clang-format +- repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black +- repo: https://github.com/ahans/cmake-format-precommit + rev: 8e52fb6506f169dddfaa87f88600d765fca48386 + hooks: + - id: cmake-format +- repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort