]> git.r.bdr.sh - rbdr/cologne/commitdiff
Add sonar-cloud configuration
authorRuben Beltran del Rio <redacted>
Mon, 21 Sep 2020 11:32:25 +0000 (13:32 +0200)
committerRuben Beltran del Rio <redacted>
Mon, 21 Sep 2020 11:32:25 +0000 (13:32 +0200)
.gitignore
.gitlab-ci.yml
package.json
sonar-project.properties [new file with mode: 0644]

index 3bbc2f111e42fbbf078d03703cd78ed3d8d566c2..c2a8529085cd52d9443906056072fdbe1e4fb1d7 100644 (file)
@@ -3,4 +3,6 @@
 
 ## PROJECT::SPECIFIC
 .nyc_output
 
 ## PROJECT::SPECIFIC
 .nyc_output
+coverage
 node_modules
 node_modules
+.scannerwork
index cc95c38138621763c40bc87bc10b11f4a43c3f5b..9f8dbdac26c6a7d9f04d1a7574d08d8e8619fba4 100644 (file)
@@ -1,8 +1,12 @@
 image: node:14
 
 image: node:14
 
+variables:
+  SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
+
 stages:
   - lint
   - test
 stages:
   - lint
   - test
+  - quality
 
 before_script:
     - npm install
 
 before_script:
     - npm install
@@ -16,3 +20,19 @@ test:
   stage: test
   script:
     - npm 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
+
index c6d4bdce99967801bfb94a4c3502495680c22bec..d48e098a4af2ce33b4cf8485180e5504a972efb9 100644 (file)
@@ -20,7 +20,8 @@
   "scripts": {
     "document": "jsdoc2md lib/**/*.js > doc/README.md; tap -R markdown > doc/COVERAGE.md",
     "lint": "eslint .",
   "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"
 }
   },
   "main": "./lib/cologne.js"
 }
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644 (file)
index 0000000..08b778a
--- /dev/null
@@ -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/**/*'