From 09ecee10ebc9c8cbb1fd679f4ef9c19f0c2bed33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Fri, 12 May 2017 10:54:17 +0200 Subject: [PATCH] ceph-docker-lint: do not check variables_entrypoint.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Shellcheck will complain with SC2034: foo appears unused. Verify it or export it. The problem here is that this file contains a reference of all the variables so indeed they appear unused. We could potentially source some portion of the code from that file, however I don't want to change the structure of the code because of shellchecker. Also sourcing all the variables might results in expected scenario if these variables are not expected to be declared. There is no way to tell shellcheck to ignore this file so we should not test it. Signed-off-by: Sébastien Han --- ceph-docker-lint/build/build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ceph-docker-lint/build/build b/ceph-docker-lint/build/build index 6add50d3..693d0387 100755 --- a/ceph-docker-lint/build/build +++ b/ceph-docker-lint/build/build @@ -4,16 +4,18 @@ set -e set -x IGNORE_THESE_CODES="SC1091,SC2015,SC2009,SC2001" +IGNORE_THESE_FILES="variables_entrypoint.sh" # pipe-separated file names, e.g: foo|bar|foobar, this avoids shellcheck complaining that vars are not used (see: SC2034) function generate_filelist(){ if [[ "$pull_request_id" -eq "" || "${ghprbCommentBody:-}" = "jenkins lint all" ]] then - find . -name '*.sh' + find . -name '*.sh' | grep -vE "$IGNORE_THESE_FILES" else curl -XGET "https://api.github.com/repos/ceph/ceph-docker/pulls/$pull_request_id/files" | jq '.[].filename' | # just the files please tr -d '"' | # remove the quoting from JSON - grep ".sh$" # just the bash + grep ".sh$" | # just the bash + grep -vE "$IGNORE_THESE_FILES" fi } -- 2.39.5