]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-docker-lint: do not check variables_entrypoint.sh 713/head
authorSébastien Han <seb@redhat.com>
Fri, 12 May 2017 08:54:17 +0000 (10:54 +0200)
committerSébastien Han <seb@redhat.com>
Fri, 12 May 2017 13:43:59 +0000 (15:43 +0200)
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 <seb@redhat.com>
ceph-docker-lint/build/build

index 6add50d396f2f9f196d6f70c61ef8cfd0db518ee..693d03878803332558d5ae64f65f840e19c93975 100755 (executable)
@@ -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
 
 }