From 8bdcf243ec7e24d105a9c1ba94cc3654d46bcbd7 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Tue, 9 Mar 2021 15:29:40 -0700 Subject: [PATCH] Add lint to ensure spaces are used for indentation --- .github/workflows/ci.yml | 6 ++++-- scripts/lint/indent.sh | 6 ++++++ scripts/{ => lint}/spdx.sh | 0 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100755 scripts/lint/indent.sh rename scripts/{ => lint}/spdx.sh (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3fafc65..0ffb4e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,12 +5,14 @@ on: pull_request: jobs: - spdx: + lint: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Check SPDX identifiers - run: ./scripts/spdx.sh + run: ./scripts/lint/spdx.sh + - name: Check indentation + run: ./scripts/lint/indent.sh tool: strategy: diff --git a/scripts/lint/indent.sh b/scripts/lint/indent.sh new file mode 100755 index 0000000..553e79f --- /dev/null +++ b/scripts/lint/indent.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-only +# Check files do not use tabs for indentation + +git ls-files '*.[c\|h\|rs\|sh]' | xargs grep --line-number $'^\s*\t' && exit 1 +exit 0 diff --git a/scripts/spdx.sh b/scripts/lint/spdx.sh similarity index 100% rename from scripts/spdx.sh rename to scripts/lint/spdx.sh