From 1c0c36015b830143cf29d1f694c27347f31d453a Mon Sep 17 00:00:00 2001 From: Yorick Downe Date: Fri, 3 Nov 2023 10:05:45 +0000 Subject: [PATCH] Pre-commit --- .github/workflows/lint.yml | 17 +++++++++++++++++ .pre-commit-config.yaml | 22 ++++++++++++++++++++++ CONTRIBUTING.md | 8 ++++++++ 3 files changed, 47 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .pre-commit-config.yaml create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..a5775b7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,17 @@ +name: Lint sources +run-name: Lint sources + +on: + push: + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Lint sources + run: | + pip install pre-commit + pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..32b604c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,22 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace-fixer + - id: end-of-file-fixer + - id: check-json + - id: check-yaml + - id: double-quote-string-fixer + - id: check-shebang-scripts-are-executable + - id: check-executables-have-shebangs + - id: detect-private-key + - id: detect-aws-credentials +repos: +- repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 3.0.0 + hooks: + - id: shellcheck + - id: script-must-have-extension + - id: git-dirty + - id: git-check + - id: forbid-binary diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5cec1c2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,8 @@ +# Contributing + +Contributions are welcome. All contributed code will be covered by the Apache License v2 of this project. + +## Linting + +The CI uses [pre-commit](https://pre-commit.com/) to lint all code within the repo. Add it to your local +copy with `pip install pre-commit` and `pre-commit install`.