Skip to content

etiennecadicidean/sonar-flutter

 
 

Repository files navigation

CI Coverage

SonarQube plugin for Flutter / Dart

A plugin to enable analysis of Dart and Flutter projects into SonarQube.

main.png

Features

Feature Supported
Size YES
Issues YES (dartanalyzer rules)
Tests YES
Coverage YES
Complexity YES
Syntax YES

The plugin is compatible with sonarQube 6.7+.

Download

Checkout the Releases page.

Changelog is available here.

Prerequisites

Flutter SDK

Install Flutter as explained on the official documentaiton page.

Installation instructions

Dart

Dart is downloaded by the Flutter SDK in $FLUTTER_HOME/bin/cache/dart-sdk, however command lines are not on the path by default (dartanalyzer must be on the path).

It is recommanded to install Dart SDK separately as explained here : Install the Dart SDK for more reliability in a CI/CD environement.

sonar-scanner (requires Java)

Install sonar-scanner as explained in the official documentation.

Installation instructions

Installation (on the server)

  • Download the plugin binary into the $SONARQUBE_HOME/extensions/plugins directory.
  • Restart the server.

Project configuration

Create a sonar-project.properties file at the root with this content :

# Project identification
sonar.projectKey=flutter_rocks
sonar.projectName=Flutter Rocks
sonar.projectVersion=1.0
	
# 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
sonar.tests=test
	
# Encoding of the source code. Default is default system encoding.
sonar.sourceEncoding=UTF-8

For a complete list of available options, please refer to the SonarQube documentation.

Run analysis

Use the following commands from the root folder to start an analysis:

# Download dependencies 
flutter pub get 
# Run tests
flutter test --machine > tests.output
# Compute coverage (--machine and --coverage cannot be run at once...)
flutter test --coverage
# Run the analysis and publish to the SonarQube server
sonar-scanner

Contributing

Any help is welcome, and PRs will be greatly appreciated!

License

SonarQube Plugin for Flutter / Dart is released under the GNU LGPL v3 license. See the LICENSE file for more information.

About

SonarQube plugin for Flutter / Dart

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 96.2%
  • ANTLR 2.4%
  • Other 1.4%