DEV Community

Discussion on: Flutter continuous code inspection with Sonarqube

Collapse
 
devonbritton profile image
DevonBritton

Hi there.

I'm using a sample flutter project to test this process and I've got analysis working on my (on-prem but remote) SonarQube server but I'm not getting any code coverage.

I'm using Azure DevOps 2020 and Sonarqube 8.5.1. I'm also using the Flutter Azure DevOps extension as I was having issues running the commands as CMD line tasks.

I would appreciate any assistance...

My yaml pipeline looks like this...

trigger:
branches:
include:
- master
pr: none

jobs:

  • job: Test
    pool: Default

    steps:

    • task: FlutterInstall@0 displayName: Setup flutter inputs: channel: 'stable' version: 'latest'
    • task: SonarQubePrepare@4 inputs: SonarQube: 'Sonar-direct' scannerMode: 'CLI' configMode: 'file' extraProperties: | # Additional properties that will be passed to the scanner, # Put one key=value per line, example: # sonar.exclusions=*/.bin sonar.login=$(sonar.login) sonar.password=$(sonar.password)
    • task: PowerShell@2 displayName: Setup environment inputs: targetType: 'inline' script: | Write-Host "##vso[task.prependpath]$(JAVA_HOME_11_X64)" Write-Host "##vso[task.setvariable variable=JAVA_HOME;]$(JAVA_HOME_11_X64)" Write-Host "##vso[task.prependpath]$(FlutterToolPath)" Write-Host "##vso[task.prependpath]$(FlutterToolPath)/cache/dart-sdk/bin"

    #- task: FlutterTest@0
    # inputs:
    # projectDirectory: '$(Build.Repository.LocalPath)'

    • task: FlutterCommand@0 displayName: flutter get inputs: arguments: 'flutter pub get'
    • task: FlutterCommand@0 displayName: flutter test inputs: arguments: 'flutter test --machine > tests.output'
    • task: FlutterCommand@0 displayName: flutter test coverage inputs: arguments: 'flutter test --coverage'
    • task: SonarQubeAnalyze@4 displayName: Run analyze

    #- task: SonarQubePublish@4
    # displayName: Run publish
    # inputs:
    # pollingTimeoutSec: '300'