From 72c168d8b2bd7e990c3c36b214f976183f1982da Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Thu, 20 Jun 2024 21:59:30 -0700 Subject: [PATCH] Configure super-linter for shfmt tool --- .editorconfig | 9 +++++++++ .github/workflows/linter.yml | 1 + Makefile | 6 +++--- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..63e62b9f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +[*.sh] +indent_style = space +indent_size = 4 + +[playbooks/roles/pmem/files/**] +ignore = true + +[spec/**] +ignore = true diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 8c990d76..5b5e7225 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -45,6 +45,7 @@ jobs: LINTER_RULES_PATH: / VALIDATE_KUBERNETES_KUBEVAL: false VALIDATE_NATURAL_LANGUAGE: false + EDITORCONFIG_FILE_NAME: .editorconfig KUBERNETES_KUBECONFORM_OPTIONS: '-ignore-missing-schemas -ignore-filename-pattern custom-rules.yml' check-tox: name: Check syntax (tox) diff --git a/Makefile b/Makefile index 192fe43b..2f194184 100644 --- a/Makefile +++ b/Makefile @@ -16,14 +16,14 @@ lint: -e LINTER_RULES_PATH=/ \ -e VALIDATE_KUBERNETES_KUBEVAL=false \ -e VALIDATE_NATURAL_LANGUAGE=false \ + -e EDITORCONFIG_FILE_NAME=.editorconfig \ -e KUBERNETES_KUBECONFORM_OPTIONS='-ignore-missing-schemas -ignore-filename-pattern custom-rules.yml' \ github/super-linter tox -e lint .PHONY: fmt fmt: - sudo -E $(DOCKER_CMD) run --rm -u "$$(id -u):$$(id -g)" \ - -v "$$(pwd):/mnt" -v /mnt/spec -v /mnt/playbooks/roles/pmem/files/ \ - -w /mnt mvdan/shfmt -l -w -i 4 -s . + command -v shfmt > /dev/null || curl -s "https://i.jpillora.com/mvdan/sh!!?as=shfmt" | bash + shfmt -l -w -s . command -v yamlfmt > /dev/null || curl -s "https://i.jpillora.com/google/yamlfmt!!" | bash yamlfmt -dstar **/*.{yaml,yml}