diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 121f450a6977530636ca805aad3723cea617850d..45c547cd070ace1178a294aab91e496b4bcf9127 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ stages: - install - release - deploy + - linters workflow: rules: @@ -257,3 +258,40 @@ post_cleaning: - ${environment} script: - ./ci/cleaning_fs.sh + +.code-quality: &code-climate + stage: linters + image: + name: registry.hpc.epfl.ch/scitas/linters-collection:latest + pull_policy: always + allow_failure: true + after_script: + - | + if [ ! -s gl-codequality.json ]; then + echo [] | tee gl-codequality.json | jq -C .; + fi + artifacts: + reports: + codequality: [gl-codequality.json] + paths: + - gl-codequality.json + +cq:hadolint: + <<: *code-climate + script: + - hadolint --format codeclimate dockerfiles/**/Dockerfile | tee gl-codequality.json | jq -C . + +cq:shellcheck: + <<: *code-climate + script: + - | + git ls-files . \ + | xargs -r -n1 file \ + | awk -F: '/shell script/{print $1}' \ + | xargs -r -n1 shellcheck -f json \ + | tee -a gl-codequality.json | jq -C . + +cq:yamllint: + <<: *code-climate + script: + - yamllint_codeclimate --standalone | tee gl-codequality.json | jq -C . diff --git a/.hadolint.yaml b/.hadolint.yaml new file mode 100644 index 0000000000000000000000000000000000000000..440d70de7dae370acfeed47b94965482530b4319 --- /dev/null +++ b/.hadolint.yaml @@ -0,0 +1,9 @@ +--- +failure-threshold: "style" # name of threshold level (error | warning | info | style | ignore | none) +format: "codeclimate" # Output format (tty | json | checkstyle | codeclimate | gitlab_codeclimate | gnu | codacy) +ignored: ["DL3041"] # list of rules +no-color: false # true | false +strict-labels: true # true | false +trustedRegistries: + - "registry.hpc.epfl.ch" # registry or list of registries + - "docker.io" diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000000000000000000000000000000000000..45efdb5af1273855af119f5a24e1b292b6a7891e --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,8 @@ +--- +extends: default + +rules: + line-length: + ignore: + - .hadolint.yaml + - .gitlab-ci.yml