Continuous Code Quality
With SonarQube
Programmer is a highly skilled professional
Source: https://www.space.com/...
And he’s responsible for his work
Source: https://www.mirror.co.uk/...
Resolution is not enough
Source: http://bonkersworld.net/...
There’s always pressure
Source: https://www.pinterest.fr/...
So before it’s too late
Source: https://www.safaribooksonline.com/...
Just stop
Source: https://medium.com/...
Keep discipline
Source: https://cleancoders.com/...
Review code
Source: https://alexandrebrisebois...
Have the rules
Source: https://www.slideshare.net/...
Analyze
Source: https://www.viva64.com/...
There are bugs
And places to refactor
Automate
Source: https://giphy.com/...
Continuously
Source: https://www.sonarqube.org/
Architecture
Source: https://docs.sonarqube.org/...
Server integration - Gradle plugin
• systemProp.sonar.host.url=http://localhost:9000
• systemProp.sonar.login=54699cc9d8eccab2b4a051e5eed0f5c638109ab3
gradle.properties
• plugins { id "org.sonarqube" version "2.6" }
• tasks.whenTaskAdded { task -> if (task.name == 'assembleDebug') { task.finalizedBy 'sonarqube' }}
app/build.gradle
Server integration - SonarQube scanner
• -Dsonar.host.url=$SONARQUBE_URL
• -Dsonar.login=$SONARQUBE_TOKEN
• -Dsonar.projectKey=$CI_PROJECT_NAMESPACE:$CI_PROJECT_NAME
• -Dsonar.sources=myapp/app/src/main
• -Dsonar.tests=myapp/app/src/test
• -Dsonar.java.binaries=myapp/app/build/intermediates/classes/sdk19Production/debug
• -Dsonar.android.lint.report=myapp/app/build/reports/lint-results-sdk19ProductionDebug.xml
arguments
execution
• sonar-scanner-$SONAR_SCANNER_VERSION/bin/sonar-scanner
$SONAR_SCANNER_ARGS
-Dsonar.projectVersion=$CI_JOB_ID
SonarLint
• on the fly detection
○ doesn’t cope well with big files
• optional server integration
• issues highlighting
• built-in explanations
Standalone IDE extension
Quality profiles
• copy built-in profiles to enable customization
• use inheritance to combine multiple profiles
Good technical debt
Source: https://blog.crisp.se/...
Quality gates
Source: https://docs.sonarqube.org/...
Demo
Source: https://linpack-for-tableau.com/...
Contact info
Mail: petr.sabata@kiwi.com
LinkedIn: https://cz.linkedin.com/in/sabatapetr
Petr Šabata
Senior Android Developer
Kiwi.com, Brno, Czech Republic
THANK YOU!

Continuous Code Quality With SonarQube