Note: This is the migration API reference for FAKE 5. The new (modularized) API documentation can be found here. If the API is already migrated you can check here if exists in a module. More information regarding the migration can be found here

SonarQube

Contains a task to run the SonarQube static code analyzer. It uses the SonarScanner for MSBuild

Nested types and modules

TypeDescription
SonarQubeParams

Parameter type to configure the SonarQube runner.

Functions and values

Function or valueDescription
finish(setParams)
Signature: setParams:(SonarQubeParams -> SonarQubeParams) option -> unit

This task can be used to run the end command of Sonar Qube on a project.

Parameters

  • setParams - Function used to overwrite the SonarQube default parameters.

Sample

open Fake.Testing

SonarQube.finish None

SonarQube.finish (Some (fun p -> { p with Settings = ["sonar.login=login"; "sonar.password=password"] }))

scan setParams doBetween
Signature: setParams:(SonarQubeParams -> SonarQubeParams) -> doBetween:(unit -> unit) -> unit

This task can be used to execute some code between the begin and end Sonar Qube on a project.

Parameters

  • setParams - Function used to overwrite the SonarQube default parameters.
  • doBetween - Function executed between begin and end Sonar Qube commands.

Sample

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
open Fake.Testing

Target.create "StaticAnalysis" (fun _ ->
  let setParams p =
    { p with Key = "ProjectKey"
             Name = "ProjectName"
             Version = "3.2.1"
             Settings =
                [ "sonar.host.url=" + SONAR_HOST_URL
                  "sonar.login=" + SONAR_TOKEN
                  "sonar.cs.opencover.reportsPaths=opencovercoverage.xml"
                ]
             // choose what you need
             // https://fake.build/dotnet-cli.html#SDK-tools-local-global-clireference
             ToolType = ToolType.CreateGlobalTool() // Start as dotnet global tool (`sonarscanner`)
             ToolType = ToolType.CreateLocalTool()  // Start as dotnet local tool (`dotnet sonarscanner`)
    }
  SonarQube.scan setParams (fun () ->
        DotNet.build id
        DotNet.test id
  )
)
namespace Fake
namespace Fake.Testing
module SonarQube

from Fake.Testing
val scan : setParams:(SonarQube.SonarQubeParams -> SonarQube.SonarQubeParams) -> doBetween:(unit -> unit) -> unit
val id : x:'T -> 'T
start(setParams)
Signature: setParams:(SonarQubeParams -> SonarQubeParams) -> unit

This task can be used to run the begin command of Sonar Qube on a project.

Parameters

  • setParams - Function used to overwrite the SonarQube default parameters.

Sample

open Fake.Testing

SonarQube.start (fun p -> { p with Key = "MyProject" Name = "MainTool" Version = "1.0 })