Skip to content

Instantly share code, notes, and snippets.

@migliori
Last active February 13, 2024 06:52
Show Gist options
  • Save migliori/e0374986e0ced38c6104eb5d1aede9e3 to your computer and use it in GitHub Desktop.
Save migliori/e0374986e0ced38c6104eb5d1aede9e3 to your computer and use it in GitHub Desktop.
SonarQube Cheatsheet #sonarqube #api

SonarQube Cheatsheet

Start / Stop SonarQube server

// start
C:\sonarqube\bin\windows-x86-64\StartSonar.bat

// stop
C:\sonarqube\bin\windows-x86-64\StopSonar.bat

run scanner:

cd C:\...\project
sonar-scanner

API Documentation & Examples

Documentation: http://localhost:9000/web_api/

// list analysis
curl -u admin:admin http://localhost:9000/api/project_analyses/search?project=php-crud-generator

// delete analysis
curl -X POST -u admin:admin http://localhost:9000/api/project_analyses/delete?analysis=AXNiozDvLO6cj1hFxYNP

sonar-project.properties Example

# must be unique in a given SonarQube instance
sonar.projectKey=my-project

# this is the name displayed in the SonarQube UI
sonar.projectName=My Project

sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.
sonar.projectBaseDir=C:/Users/.../my-project

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

# Global exclusions
sonar.global.exclusions=**/*.java,**/vendor/**/*,**/cgi-bin/**/*,**/.vscode/**/*

# Project exclusions
sonar.exclusions=**/server-update/**/*,**/*.ts

sonar.scm.disabled=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment