SonarQube with Flutter
Flutter is not natively supported by SonarQube but there is an open source plugin which can be used for the purpose. Follow the steps below to support flutter with SonarQube.
Step 1:
SonarQube was installed with sonar user hence we switch to sonar user for flutter setup
sudo su
su sonar
Step 2:
cd /opt/sonarqube/extensions/plugins/
Step 3:
Download plugin jar file:
https://github.com/insideapp-oss/sonar-flutter/releases
Download SonarQube Plugin for flutter
wget https://github.com/insideapp-oss/sonar-flutter/releases/download/0.3.1/sonar-flutter-plugin-0.3.1.jar
Step 4:
Adding flutter to SonarQube Server
git clone https://github.com/flutter/flutter.git
Step 5:
Setting up permanent path for flutter:
vi ~/.bashrc
Add below path
export PATH="/home/sonar/flutter/bin:$PATH"
export PATH="/home/sonar/flutter/bin/cache/dart-sdk/bin:$PATH"
source path
source ~/.bashrc
verify path
echo $PATH
/home/sonar/flutter/bin/cache/dart-sdk/bin:/home/sonar/flutter/bin:/home/rohit.ranjan/flutter/bin/cache/dart-sdk/bin:/home/rohit.ranjan/flutter/bin:/sbin:/bin:/usr/sbin:/usr/bin
Step 6:
Execute command
flutter doctor
Step 7:
After successful execution of command in step 6, below files should be present
ls /home/sonar/flutter/bin
cache dart dart.bat flutter flutter.bat internal
Dart-sdk
ls /home/sonar/flutter/bin/cache/dart-sdk/bin
dart dart2js dart2native dartanalyzer dartaotruntime dartdevc dartdoc dartfmt pub resources snapshots utils
Step 8:
Restart SonarQube server from UI