From c17da75c1f8e9114913a1f383d9f61116cdf5374 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Thu, 21 Sep 2023 23:56:44 +0200 Subject: [PATCH] Add an helper script to run codacy-analysis-cli locally Used to validate .markdownlint.json --- scripts/tools/run_codacy_analysis.sh | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 scripts/tools/run_codacy_analysis.sh diff --git a/scripts/tools/run_codacy_analysis.sh b/scripts/tools/run_codacy_analysis.sh new file mode 100755 index 000000000..b341c9766 --- /dev/null +++ b/scripts/tools/run_codacy_analysis.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -ex + +# Run codacy-analysis-cli using markdownlint tool by default +# +# Optionally use the tool passed as argument +# List is available at https://docs.codacy.com/repositories-configure/codacy-configuration-file/#which-tools-can-be-configured-and-which-name-should-i-use +# +# Requires docker +# See https://github.com/codacy/codacy-analysis-cli for details + +if [ -z "$1" ]; then + TOOL=markdownlint +else + # use tool passed as command-line argument + TOOL="$1" +fi + +# change to picard source directory +pushd "$(dirname "$0")/../../" || exit + +CODACY_CODE="$(pwd)" +docker run \ + --rm=true \ + --env CODACY_CODE="$CODACY_CODE" \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + --volume "$CODACY_CODE":"$CODACY_CODE":ro \ + --volume /tmp:/tmp \ + codacy/codacy-analysis-cli \ + analyze --verbose --tool "$TOOL" + +popd