public interface SensorContext
Sensor.execute(SensorContext)
In order to write unit tests you can use SensorContextTester
Modifier and Type | Method and Description |
---|---|
ActiveRules |
activeRules()
Get list of active rules.
|
void |
addContextProperty(String key,
String value)
Add a property to the scanner context.
|
Configuration |
config()
Get settings of the current module, or of the project for a global Sensor.
|
FileSystem |
fileSystem()
Get filesystem of the current module.
|
Version |
getSonarQubeVersion()
Version of API at runtime, not at compilation time.
|
boolean |
isCancelled()
Test if a cancellation of the analysis was requested.
|
void |
markForPublishing(InputFile inputFile)
Indicate that a file should be published in the report sent to SonarQube.
|
InputModule |
module() |
NewAnalysisError |
newAnalysisError()
Builder to declare errors that happened while processing a source file.
|
NewCoverage |
newCoverage()
Builder to define coverage in a file.
|
NewCpdTokens |
newCpdTokens()
Builder to define CPD tokens in a file.
|
NewHighlighting |
newHighlighting()
Builder to define highlighting of a file.
|
NewIssue |
newIssue()
Fluent builder to create a new
Issue . |
<G extends Serializable> |
newMeasure()
Fluent builder to create a new
Measure . |
NewSymbolTable |
newSymbolTable()
Builder to define symbol table of a file.
|
SonarRuntime |
runtime()
Runtime information, mainly:
to be able to have different behaviours between SonarQube and SonarLint
to enable new features depending on version of API available at runtime
|
Settings |
settings()
Deprecated.
since 6.5 use
config() |
@Deprecated Settings settings()
config()
Configuration config()
FileSystem fileSystem()
ActiveRules activeRules()
InputModule module()
Version getSonarQubeVersion()
runtime().getApiVersion()
since 6.0.since version 6.0.
SonarRuntime runtime()
boolean isCancelled()
true
. For example it could be tested between each processed file.<G extends Serializable> NewMeasure<G> newMeasure()
Measure
. Don't forget to call NewMeasure.save()
once all parameters are provided.NewIssue newIssue()
Issue
. Don't forget to call NewIssue.save()
once all parameters are provided.NewHighlighting newHighlighting()
NewHighlighting.save()
once all elements are provided.NewSymbolTable newSymbolTable()
NewSymbolTable.save()
once all symbols are provided.NewCoverage newCoverage()
NewCoverage.save()
.NewCpdTokens newCpdTokens()
NewCpdTokens.save()
.NewAnalysisError newAnalysisError()
NewAnalysisError.save()
.void addContextProperty(String key, String value)
"sonar.analysis."
are included to the
payload of webhooks.IllegalArgumentException
- if key or value parameter is nullPostProjectAnalysisTask.ProjectAnalysis.getScannerContext()
void markForPublishing(InputFile inputFile)
Copyright © 2009–2018 SonarSource. All rights reserved.