From: Ruben Beltran del Rio Date: Mon, 21 Sep 2020 11:32:25 +0000 (+0200) Subject: Add sonar-cloud configuration X-Git-Url: https://git.r.bdr.sh/rbdr/cologne/commitdiff_plain/7ce5b3cbaee53475db87b40236b481c16532c968?ds=inline;hp=d1571ede7507713d9262e00f94146b405f798150 Add sonar-cloud configuration --- diff --git a/.gitignore b/.gitignore index 3bbc2f1..c2a8529 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ ## PROJECT::SPECIFIC .nyc_output +coverage node_modules +.scannerwork diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc95c38..9f8dbda 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,12 @@ image: node:14 +variables: + SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache + stages: - lint - test + - quality before_script: - npm install @@ -16,3 +20,19 @@ test: stage: test script: - npm test + +quality: + image: + name: sonarsource/sonar-scanner-cli:latest + entrypoint: [""] + cache: + key: "${CI_JOB_NAME}" + paths: + - .sonar/cache + script: + - npm run coverage + - sonar-scanner + only: + - merge_requests + - master + diff --git a/package.json b/package.json index c6d4bdc..d48e098 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "scripts": { "document": "jsdoc2md lib/**/*.js > doc/README.md; tap -R markdown > doc/COVERAGE.md", "lint": "eslint .", - "test": "tap" + "test": "tap", + "coverage": "nyc report --reporter=text-lcov" }, "main": "./lib/cologne.js" } diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..08b778a --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,12 @@ +sonar.projectKey=rbdr_cologne +sonar.organization=rbdr + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +sonar.sources=. + +# Encoding of the source code. Default is default system encoding +sonar.sourceEncoding=UTF-8 + +# Coverage path +sonar.javascript.lcov.reportPaths=coverage/lcov.info +sonar.coverage.exclusions='test/**/*'