From 0cd499eee131ffc5526695d20cd0db48b4611548 Mon Sep 17 00:00:00 2001 From: jo Date: Thu, 27 May 2021 15:10:58 +0200 Subject: [PATCH] Add pre-commit setup - Add pre-commit hooks - Add github action to enforce pre-commit setup For any hooks required for a 'sub project', for instance the UI. It will be possible to create custom hooks, and call some package scripts in the package.json file. Fixes #1208 --- .codespellignore | 2 ++ .github/workflows/lint.yml | 14 +++++++++++ .pre-commit-config.yaml | 50 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 .codespellignore create mode 100644 .github/workflows/lint.yml create mode 100644 .pre-commit-config.yaml diff --git a/.codespellignore b/.codespellignore new file mode 100644 index 000000000..a04dbeef4 --- /dev/null +++ b/.codespellignore @@ -0,0 +1,2 @@ +hda +HDA diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..b943e5ae8 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,14 @@ +name: lint + +on: + pull_request: + push: + branches: [master] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..cbea7daa4 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,50 @@ +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +exclude: ^(airtime_mvc.*)$ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + - id: check-symlinks + - id: destroyed-symlinks + + - id: check-json + - id: check-yaml + - id: check-yaml + - id: check-toml + + - id: check-merge-conflict + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + + - id: fix-encoding-pragma + - id: requirements-txt-fixer + - id: name-tests-test + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.3.0 + hooks: + - id: prettier + files: \.(md|yml|yaml|json)$ + + - repo: https://github.com/psf/black + rev: 21.5b1 + hooks: + - id: black + + - repo: https://github.com/pre-commit/mirrors-pylint + rev: v3.0.0a3 + hooks: + - id: pylint + + - repo: https://github.com/codespell-project/codespell + rev: v2.0.0 + hooks: + - id: codespell + args: [--ignore-words=.codespellignore]