diff --git a/.github/workflows/test-lint-deploy.yml b/.github/workflows/test-lint-deploy.yml index 945b05f..bbc1302 100644 --- a/.github/workflows/test-lint-deploy.yml +++ b/.github/workflows/test-lint-deploy.yml @@ -92,8 +92,8 @@ jobs: chmod +x mdslw sudo mv mdslw /usr/local/bin env: - MDSLW_VERSION: 0.11.1 - MDSLW_SHA256: 75a172e9d9a59793a4dbb5adb0e0dd0778171c6aa07188fc0733bb20c6889e1e + MDSLW_VERSION: 0.12.4 + MDSLW_SHA256: 2899399d14c230f3bc3e4d8b275a1e7a61f061e65fc58e79a0ef1802c1c534bf BASE_URL: "https://github.com/razziel89/mdslw/releases/download" - uses: actions/checkout@v3 diff --git a/Makefile b/Makefile index 5fa5b24..6f00f29 100644 --- a/Makefile +++ b/Makefile @@ -29,15 +29,25 @@ check-dependencies: command -v shellcheck &>/dev/null || (echo "ERROR, please install shellcheck" >&2; exit 1) command -v shfmt &>/dev/null || (echo "ERROR, please install shfmt" >&2; exit 1) command -v jq &>/dev/null || (echo "ERROR, please install jq" >&2; exit 1) - command -v kcov &>/dev/null || (echo "ERROR, please install kcov " >&2; exit 1) + command -v kcov &>/dev/null || (echo "ERROR, please install kcov" >&2; exit 1) + command -v mdslw &>/dev/null || (echo "ERROR, please install mdslw" >&2; exit 1) -SHELLCHECK_OPTS := --enable=add-default-case,avoid-nullary-conditions,quote-safe-variables,require-variable-braces -export SHELLCHECK_OPTS +SHELLCHECK_OPTS := --external-sources --enable=add-default-case,avoid-nullary-conditions,quote-safe-variables,require-variable-braces +SHFMT_OPTS := --space-redirects --binary-next-line --indent 2 +MDSLW_OPTS := --upstream="prettier --parser=markdown" .PHONY: lint lint: - shellcheck ./bin/* ./lib/* ./tests/* - $(MAKE) check-format + shellcheck $(SHELLCHECK_OPTS) ./bin/* ./lib/* ./tests/* + shfmt --diff $(SHFMT_OPTS) --language-dialect bash ./bin/* ./lib/* + shfmt --diff $(SHFMT_OPTS) --language-dialect bats ./tests/* + mdslw --mode=check $(MDSLW_OPTS) . + +format: + shfmt --write --simplify $(SHFMT_OPTS) --language-dialect bash ./bin/* ./lib/* + shfmt --write --simplify $(SHFMT_OPTS) --language-dialect bats ./tests/* + mdslw --mode=format --upstream="prettier --parser=markdown" . + shellcheck --format=diff $(SHELLCHECK_OPTS) bin/* lib/* tests/* | git apply --allow-empty # Run tests under all possible combinations of some shell options. .PHONY: test @@ -57,7 +67,7 @@ build-bash-version: # Ensure that the arguments have been set. [[ -n "$(BASH_VERSION)" && -n "$(BASH_PATH)" ]] cd "$(BASH_PATH)" && \ - curl -sSfL -o bash.tar.gz "$(DOWNLOAD_URL_PREFIX)/bash-$(BASH_VERSION).tar.gz" && \ + curl -fL -o bash.tar.gz "$(DOWNLOAD_URL_PREFIX)/bash-$(BASH_VERSION).tar.gz" && \ tar -xvzf bash.tar.gz && \ cd "bash-$(BASH_VERSION)" && \ ./configure && \ @@ -122,17 +132,6 @@ coverage: test } \ }' < <(jq < $$(ls -d1 .coverage/bats.*/coverage.json) | sed 's/,$$//') -format: - shfmt -w -s -bn -i 2 -sr -ln bash ./bin/* ./lib/* - shfmt -w -s -bn -i 2 -sr -ln bats ./tests/* - mdslw --mode=format --upstream="prettier --parser=markdown" . - shellcheck --format=diff bin/* lib/* tests/* | git apply --allow-empty - -check-format: - shfmt -d -s -bn -i 2 -sr -ln bash ./bin/* ./lib/* - shfmt -d -s -bn -i 2 -sr -ln bats ./tests/* - mdslw --mode=check --upstream="prettier --parser=markdown" . - build: ./generate_deployable.sh diff --git a/README.md b/README.md index d1a2dd3..bb472a9 100644 --- a/README.md +++ b/README.md @@ -127,21 +127,20 @@ But we are eager to hear your feedback on how we could improve! Shellmock is open-sourced under the Apache-2.0 license. See the [LICENSE](./LICENSE) file for details. -> Copyright (c) 2022 - for information on the respective copyright owner -> see the NOTICE file or the repository -> https://github.com/boschresearch/shellmock +> Copyright (c) 2022 - for information on the respective copyright owner see the +> NOTICE file or the repository https://github.com/boschresearch/shellmock > > 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 +> 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. +> WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +> See the License for the specific language governing permissions and +> limitations under the License.