diff --git a/Makefile b/Makefile index c221bc4..0aaaac3 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ ruff: ## Run Ruff linter docs-style: ## Check documentation strings in all Python sources from this repository pydocstyle . +shellcheck: ## Run shellcheck + ./shellcheck.sh + help: ## Show this help screen @echo 'Usage: make ... ' @echo '' diff --git a/shellcheck.sh b/shellcheck.sh new file mode 100755 index 0000000..a146b64 --- /dev/null +++ b/shellcheck.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Copyright 2020 Red Hat, Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if ! command -v shellcheck > /dev/null 2>&1; then + scversion="stable" # or "v0.4.7", or "latest" + wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv + shellcheck-stable/shellcheck --version + shellcheck-stable/shellcheck --exclude=SC2230 -- *.sh +else + shellcheck --exclude=SC2230 -- *.sh +fi