Package org.sonar.api.batch.sensor.issue
Interface NewIssue
-
public interface NewIssue
Represents an issue detected by aSensor
.- Since:
- 5.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
NewIssue.FlowType
The type of the flow reported for a given issue.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description NewIssue
addFlow(java.lang.Iterable<NewIssueLocation> flowLocations)
Register a flow for this issue.NewIssue
addFlow(java.lang.Iterable<NewIssueLocation> flowLocations, NewIssue.FlowType flowType, java.lang.String flowDescription)
Register a flow for this issue.NewIssue
addLocation(NewIssueLocation secondaryLocation)
Add a secondary location for this issue.NewIssue
addQuickFix(NewQuickFix newQuickFix)
Add a new quick fix to this issue.NewIssue
at(NewIssueLocation primaryLocation)
Primary location for this issue.NewIssue
forRule(RuleKey ruleKey)
TheRuleKey
of the issue.NewIssue
gap(java.lang.Double gap)
Gap used for the computation of the effort.NewIssueLocation
newLocation()
Create a new location for this issue.NewQuickFix
newQuickFix()
Create a new quick fix.NewIssue
overrideImpact(SoftwareQuality softwareQuality, Severity severity)
Override severity of an impact defined by the rule.NewIssue
overrideSeverity(Severity severity)
Deprecated.since 10.1, useoverrideImpact(SoftwareQuality, org.sonar.api.issue.impact.Severity)
insteadvoid
save()
Save the issue.NewIssue
setCodeVariants(java.lang.Iterable<java.lang.String> codeVariants)
Registers a list of code variants for this issue.NewIssue
setQuickFixAvailable(boolean quickFixAvailable)
Register if a QuickFix would be available on SonarLint for this issue.NewIssue
setRuleDescriptionContextKey(java.lang.String ruleDescriptionContextKey)
Set the optional rule description section context key.
-
-
-
Method Detail
-
gap
NewIssue gap(@Nullable java.lang.Double gap)
Gap used for the computation of the effort.- Since:
- 5.5
-
overrideSeverity
@Deprecated(since="10.1") NewIssue overrideSeverity(@Nullable Severity severity)
Deprecated.since 10.1, useoverrideImpact(SoftwareQuality, org.sonar.api.issue.impact.Severity)
insteadOverride severity of the issue. Setting a null value or not calling this method means to use severity configured in quality profile.
-
overrideImpact
NewIssue overrideImpact(SoftwareQuality softwareQuality, Severity severity)
Override severity of an impact defined by the rule. The impact for the SoftwareQuality must have already been defined by the rule.- Since:
- 10.1
-
at
NewIssue at(NewIssueLocation primaryLocation)
Primary location for this issue.- Since:
- 5.2
-
addLocation
NewIssue addLocation(NewIssueLocation secondaryLocation)
Add a secondary location for this issue. Several secondary locations can be registered.- Since:
- 5.2
-
setQuickFixAvailable
NewIssue setQuickFixAvailable(boolean quickFixAvailable)
Register if a QuickFix would be available on SonarLint for this issue.- Since:
- 9.2
-
addFlow
NewIssue addFlow(java.lang.Iterable<NewIssueLocation> flowLocations)
Register a flow for this issue. A flow is an ordered list of issue locations that help to understand the issue. It should be a path that backtracks the issue from its primary location to the start of the flow. Several flows can be registered. The type of the flow will be undefined.- Since:
- 5.2
-
addFlow
NewIssue addFlow(java.lang.Iterable<NewIssueLocation> flowLocations, NewIssue.FlowType flowType, @Nullable java.lang.String flowDescription)
Register a flow for this issue. A flow is an ordered list of issue locations that help to understand the issue. It should be a path that backtracks the issue from its primary location to the start of the flow. Several flows can be registered.- Parameters:
flowType
- specifies type of flow that is being added. For details seeFlowType
.flowDescription
- optional description associated with a flow.- Since:
- 9.11
-
newLocation
NewIssueLocation newLocation()
Create a new location for this issue. First registered location is considered as primary location.- Since:
- 5.2
-
newQuickFix
NewQuickFix newQuickFix()
Create a new quick fix. UseaddQuickFix(NewQuickFix)
to finish registering the new quick fix.- Returns:
- a new uninitialized instance of a quick fix for this issue
- Since:
- 9.13
-
addQuickFix
NewIssue addQuickFix(NewQuickFix newQuickFix)
Add a new quick fix to this issue. While products should do their best to display quick fixes in the order they are contributed, sometimes due to external factors the quick fixes might be displayed in a different order.- Parameters:
newQuickFix
- the quick fix to add- Returns:
- this object
- Since:
- 9.13
-
save
void save()
Save the issue. If rule key is unknown or rule not enabled in the current quality profile then a warning is logged but no exception is thrown.
-
setRuleDescriptionContextKey
NewIssue setRuleDescriptionContextKey(@Nullable java.lang.String ruleDescriptionContextKey)
Set the optional rule description section context key. The key needs to match the one present inContext.getKey()
.- Since:
- 9.8
-
setCodeVariants
NewIssue setCodeVariants(@Nullable java.lang.Iterable<java.lang.String> codeVariants)
Registers a list of code variants for this issue. In C and C++, it is commonplace to have multiple code variants. Two source codes are defined here as variants of each other if there is any difference in their preprocessed source code.- Since:
- 9.17
-
-