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(java.lang.String key,
java.lang.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.
|
NewExternalIssue |
newExternalIssue()
Fluent builder to create a new
ExternalIssue . |
NewHighlighting |
newHighlighting()
Builder to define highlighting of a file.
|
NewIssue |
newIssue()
Fluent builder to create a new
Issue . |
<G extends java.io.Serializable> |
newMeasure()
Fluent builder to create a new
Measure . |
NewSignificantCode |
newSignificantCode()
Builder to declare which parts of the code is significant code.
|
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() |
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 java.io.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.NewExternalIssue newExternalIssue()
ExternalIssue
. Don't forget to call NewExternalIssue.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()
.NewSignificantCode newSignificantCode()
void addContextProperty(java.lang.String key, java.lang.String value)
"sonar.analysis."
are included to the
payload of webhooks.java.lang.IllegalArgumentException
- if key or value parameter is nullPostProjectAnalysisTask.ProjectAnalysis.getScannerContext()
void markForPublishing(InputFile inputFile)