github.com/nilium/gitlab-runner@v12.5.0+incompatible/scripts/codequality (about)

     1  #!/bin/sh
     2  
     3  set -eo pipefail
     4  
     5  code_path=$(pwd)
     6  
     7  # docker run --tty will merge stderr and stdout, we don't need this on CI or
     8  # it will break codequality json file
     9  [ "$CI" != "" ] || docker_tty="--tty"
    10  
    11  # Preparing gocyclo analyzer
    12  docker pull registry.gitlab.com/nolith/codeclimate-gocyclo > /dev/null
    13  docker tag registry.gitlab.com/nolith/codeclimate-gocyclo codeclimate/codeclimate-gocyclo > /dev/null
    14  
    15  # Preparing gofmt analyzer
    16  #
    17  # We're forcing the `b65` version because this is the oldest one that
    18  # doesn't require go1.12 compatible formatting. Since we're still not using
    19  # go1.12+ it's better to set specific version of gofmt analyzer than
    20  # to manually update formatting for go1.12 (which is especially hard ant
    21  # frustrating when using an IDE) while still using the old version of Go
    22  # for development.
    23  docker pull codeclimate/codeclimate-gofmt:b65 > /dev/null
    24  docker tag codeclimate/codeclimate-gofmt:b65 codeclimate/codeclimate-gofmt:latest > /dev/null
    25  
    26  # Executing codeclimate check
    27  exec docker run --rm $docker_tty --env CODECLIMATE_CODE="$code_path" \
    28  	--volume "$code_path":/code \
    29  	--volume /var/run/docker.sock:/var/run/docker.sock \
    30  	--volume /tmp/cc:/tmp/cc \
    31  	codeclimate/codeclimate:0.83.0 "$@"
    32