Trying to run static code analyzer sonarqube for my Flutter project.
Steps currently followed,
- Downloaded Sonarqube community version.
- Downloaded the SonarQube flutter plugin
- Moved the Jar file to the extension/plugins folder, verified it is in the installed plugin in the Sonarqube dashboard.
- Downloaded sonar-scanner.
- Added the
sonar-project.propertisefile in the project, refer the code in the below section. - Ran sonar-scanner, logs shows as execution is successful, attached in the below section.
When I go to the Sonarqube dashboard (at, http://localhost:9000), it show an warning saying, The main branch has no lines of code.,
Not sure what is incorrect here, I tried creating a new flutter project from scratch which doesn't have any VCS, but still same error, stuck on this for quite long.
Logs:
INFO: ANALYSIS SUCCESSFUL, you can find the results at: http://localhost:9000/dashboard?id=test_sonar_flutter
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=45188e45-b98e-40d7-aaed-10f35803fdaf
INFO: Analysis total time: 6.024 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 7.456s
INFO: Final Memory: 24M/108M
INFO: ------------------------------------------------------------------------
sonar-project.properties
sonar.projectKey=test_sonar_flutter
sonar.projectName=test_sonar_flutter
sonar.login=token (Added token from sonar qube dashbaord)
# The host URL
sonar.host.url=http://localhost:9000
sonar.dart.analyzer.options.override=true
# Source code location.
# Path is relative to the sonar-project.properties file. Defaults to .
# Use commas to specify more than one folder.
sonar.sources=lib,pubspec.yaml
sonar.tests=test
# Encoding of the source code. Default is default system encoding.
sonar.sourceEncoding=UTF-8
# exclude generated files
#sonar.exclusions=test/**/*_test.mocks.dart,lib/**/*.g.dart
Let me know if I am missing any config or something.
Versions:
- sonar-flutter-plugin: 0.5.0
- sonar-scanner: 5.0.1.3006
- sonarqube: 10.14.1