From 9ea83a4099f4aba1876c57f3cf2a66ee49c87b70 Mon Sep 17 00:00:00 2001 From: Jannick Kremer Date: Fri, 26 Jul 2024 13:09:41 +0100 Subject: [PATCH] Add .editorconfig and CI check for trailing whitespace --- .editorconfig | 3 +++ .github/workflows/check-whitespace.yml | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/workflows/check-whitespace.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..03490db50 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*] +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml new file mode 100644 index 000000000..26dfb5b06 --- /dev/null +++ b/.github/workflows/check-whitespace.yml @@ -0,0 +1,18 @@ +# Credit: https://github.com/zlib-ng/zlib-ng/blob/develop/.github/workflows/lint.yml +name: Lint +on: [pull_request] + +jobs: + lint: + name: Check trailing whitespace + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Whitespace errors + run: | + git config core.whitespace blank-at-eol + git diff --color --check ${{ github.event.pull_request.base.sha }} -- './src' ':!./src/lib' ':!./src/webSDK'