Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
en:modul:m324_aws:topics:11 [2026/01/07 13:51] dgaravaldien:modul:m324_aws:topics:11 [2026/01/10 10:21] (aktuell) – [Getting started] dgaravaldi
Zeile 54: Zeile 54:
   * Save the generated token and handle it as password.   * Save the generated token and handle it as password.
   * Hit the button ''Continue''   * Hit the button ''Continue''
 +  * Run analysis on your project: ''Other'' -> ''Linux''
 +
 +
  
 \\ \\
 === Step 4: Download and unzip the scanner === === Step 4: Download and unzip the scanner ===
   * Download the scanner for your platform.   * Download the scanner for your platform.
-  * Unzip it either in your project directory or where your tools are usually stored.  + 
-  * Add the ''bin'' directory of the unzipped folder in your ''PATH'' variable.+{{:en:modul:m324_aws:topics:01-sonar.png?direct&400|}} 
 +{{:en:modul:m324_aws:topics:02-sonar.png?direct&400|}} 
 + 
 +  * Unzip it either in your project directory or in your binary-directory. 
 +Example for Linux on AWS EC2 
 +<code> 
 +wget -N https://binaries.sonarsource.com/<whatever-path>/sonar-scanner-cli-<whatever-version>-linux-x64.zip 
 +sudo apt install unzip 
 +unzip -o sonar-scanner-cli-<whatever-version>-linux-x64.zip 
 +</code> 
 + 
 +  * Add the ''bin'' directory of the unzipped folder in your ''PATH'' variable and check with command ''whereis''Example: 
 +<code> 
 +whereis sonar-scanner 
 +sonar-scanner: /home/ubuntu/sonar/bin/sonar-scanner 
 +</code> 
   * Check before running code coverage that your target app (i.e. traffic light api) has the following node package are installed.   * Check before running code coverage that your target app (i.e. traffic light api) has the following node package are installed.
  
Zeile 94: Zeile 112:
 \\ \\
 === Step 5: Run the tests === === Step 5: Run the tests ===
 +  * On Linux: Install jest with ''sudo npm i jest-cli -g''
   * Run first the code coverage with jest.   * Run first the code coverage with jest.
  
Zeile 101: Zeile 120:
  
   * Execute the scanner as shown.   * Execute the scanner as shown.
-In the example the scanner binaries are stored in the project folder. The path to the scanner is used in a bash script. 
  
 <code> <code>
-#!/usr/bin/env bash+#!/usr/bin/bash 
 +# Attention: 
 +# Change CRLF (Windows) to LF (Unix on AWS) in your Editor
 # #
-# set tool variable +sonar-scanner 
-tool=??/M324_Code/sonar-scanner/bin/sonar-scanner.bat +  -Dsonar.projectKey=<YOUR-PROJECT-KEY> \ 
-# run tool +  -Dsonar.sources=. \ 
-$tool+  -Dsonar.host.url=<YOUR-HOST-URL>
 +  -Dsonar.token=<YOUR-TOKEN>
 +  -Dproject.settings=./sonar-project.properties
 </code> </code>
  
   * Analyse the generated report in SonarQube   * Analyse the generated report in SonarQube
  
----+{{:en:modul:m324_aws:topics:03-sonar.png?direct&800|Sample report from sonar}} 
  
-Based on this [[https://www.aviator.co/blog/implementing-sonarqube-code-coverage-in-a-simple-javascript-application/|Article]]. 
  
 ---- ----
 +Source: [[https://www.aviator.co/blog/implementing-sonarqube-code-coverage-in-a-simple-javascript-application/]].
  
 [[https://creativecommons.org/licenses/by-nc-sa/4.0/|{{https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png}}]] Daniel Garavaldi [[https://creativecommons.org/licenses/by-nc-sa/4.0/|{{https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png}}]] Daniel Garavaldi
  • en/modul/m324_aws/topics/11.1767790315.txt.gz
  • Zuletzt geändert: 2026/01/07 13:51
  • von dgaravaldi