rogerxu / rogerxu.github.io

Roger Xu's Blog
3 stars 2 forks source link

Sonar #175

Open rogerxu opened 7 years ago

rogerxu commented 7 years ago

Documentation

rogerxu commented 5 years ago

Analyzing Source Code

Overview

SonarQube Scanner

Analyzing with SonarQube Scanner - Scanners - Doc SonarQube

sonar-project.properties

Analysis Parameters

# Must be unique in a given SonarQube instance
sonar.projectKey=com.example.demo:sample-app

# This is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=Sample App
sonar.projectVersion=1.0.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=webapp
sonar.tests=webapp/test
sonar.exclusions=webapp/test/**/*,webapp/localService/**/*,webapp/WEB-INF/**/*
# sonar.test.exclusions=

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

# ESLint
sonar.eslint.reportPaths=report.json
# sonar.javascript.eslint.reportPath=target/eslint/eslint.xml
# sonar.javascript.eslint.overrideSeverity=false

# QUnit
sonar.javascript.qunit.reportPath=target/surefire-reports

# Coverage Results
sonar.javascript.lcov.reportPaths=target/coverage/lcov/lcov.info

Run Scanner

$ sonar-scanner -Dsonar.host.url=http://localhost:9000/sonar -Dsonar.login=<user_token>

Advanced SonarQube Scanner Usages - Scanners - Doc SonarQube

rogerxu commented 5 years ago

Filters

Narrowing the Focus

rogerxu commented 5 years ago

SonarJS Plugin

SonarJS - Plugins - Doc SonarQube

ESLint Report

Importing ESLint Issues Reports - Plugins - Doc SonarQube

sonar.eslint.reportPaths=report.json

Coverage Report

JavaScript Coverage Results Import - Plugins - Doc SonarQube

sonar.javascript.lcov.reportPaths=../target/coverage/lcov