From 33ac1fa3f87a5576851275d0878f71b110d1d64d Mon Sep 17 00:00:00 2001 From: metafates Date: Sun, 11 Feb 2024 18:09:10 +0300 Subject: [PATCH 1/2] chore: apply fixes from shellcheck --- deploy.sh | 2 +- ping-all.sh | 4 ++-- .../2018-April/04-collect-metrics/process-artifact.sh | 8 ++++---- research/2018-April/04-collect-metrics/run.sh | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/deploy.sh b/deploy.sh index 104abc85..4c0e56d7 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -cd $(dirname $0) +cd "$(dirname "$0")" cp /code/cqfn-secrets/jpeek-settings-heroku.xml settings.xml git add settings.xml git commit -m 'settings.xml for dokku' diff --git a/ping-all.sh b/ping-all.sh index 68b066e6..2d3960b5 100755 --- a/ping-all.sh +++ b/ping-all.sh @@ -2,6 +2,6 @@ set -e while IFS= read -r a; do - curl -s https://i.jpeek.org/${a}/index.html > /dev/null + curl -s "https://i.jpeek.org/${a}/index.html" > /dev/null echo "${a} pinged" -done < artifacts.csv \ No newline at end of file +done < artifacts.csv diff --git a/research/2018-April/04-collect-metrics/process-artifact.sh b/research/2018-April/04-collect-metrics/process-artifact.sh index 04d4033d..04f11a3d 100755 --- a/research/2018-April/04-collect-metrics/process-artifact.sh +++ b/research/2018-April/04-collect-metrics/process-artifact.sh @@ -32,12 +32,12 @@ jar=$1 output=$3 path=${2//.//} meta=$(curl --fail --silent "https://repo1.maven.org/maven2/${path}/maven-metadata.xml") -version=$(echo ${meta} | xmllint --xpath '/metadata/versioning/latest/text()' -) -group=$(echo ${meta} | xmllint --xpath '/metadata/groupId/text()' -) -artifact=$(echo ${meta} | xmllint --xpath '/metadata/artifactId/text()' -) +version=$(echo "${meta}" | xmllint --xpath '/metadata/versioning/latest/text()' -) +artifact=$(echo "${meta}" | xmllint --xpath '/metadata/artifactId/text()' -) home=$(pwd) dir=$(mktemp -d /tmp/jpeek-XXXX) +# shellcheck disable=SC2064 trap "rm -rf ${dir}" EXIT curl --fail --silent "https://repo1.maven.org/maven2/${path}/${version}/${artifact}-${version}.jar" > "${dir}/${artifact}.jar" cd "${dir}" @@ -46,4 +46,4 @@ unzip -o -q -d "${artifact}" "${artifact}.jar" java -jar "${jar}" --sources "${artifact}" --target ./target --quiet ruby "${home}/collect.rb" target >> "${output}" cd -rm -rf ${dir} +rm -rf "${dir}" diff --git a/research/2018-April/04-collect-metrics/run.sh b/research/2018-April/04-collect-metrics/run.sh index fc4f08a0..6d905e21 100755 --- a/research/2018-April/04-collect-metrics/run.sh +++ b/research/2018-April/04-collect-metrics/run.sh @@ -28,12 +28,12 @@ home=$(pwd) jar=~/.m2/repository/org/jpeek/jpeek/1.0-SNAPSHOT/jpeek-1.0-SNAPSHOT-jar-with-dependencies.jar if [ ! -e "${jar}" ]; then echo "${jar} doesn't exist, please run 'mvn clean install' first" - exit -1 + exit 1 fi rm -f "${home}/metrics.txt" -while read line +while read -r line do IFS=',' read -ra parts <<< "${line}" echo "${parts[0]}..." From 5669c01472b248f5a76c64830addada99280d75a Mon Sep 17 00:00:00 2001 From: metafates Date: Sun, 11 Feb 2024 18:11:26 +0300 Subject: [PATCH 2/2] ci: add shellcheck workflow --- .github/workflows/shellcheck.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 00000000..7776586c --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,17 @@ +--- +name: shellcheck +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + shellcheck: + name: shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master