Package org.sonar.api.batch.sensor.issue
Interface NewIssue
-
public interface NewIssueRepresents an issue detected by aSensor.- Since:
- 5.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classNewIssue.FlowTypeThe type of the flow reported for a given issue.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description NewIssueaddFlow(java.lang.Iterable<NewIssueLocation> flowLocations)Register a flow for this issue.NewIssueaddFlow(java.lang.Iterable<NewIssueLocation> flowLocations, NewIssue.FlowType flowType, java.lang.String flowDescription)Register a flow for this issue.NewIssueaddInternalTag(java.lang.String tag)Register an internal tag for this issue.NewIssueaddInternalTags(java.util.Collection<java.lang.String> tags)Register a collection of internal tags for this issue.NewIssueaddLocation(NewIssueLocation secondaryLocation)Add a secondary location for this issue.NewIssueaddQuickFix(NewQuickFix newQuickFix)Add a new quick fix to this issue.NewIssueat(NewIssueLocation primaryLocation)Primary location for this issue.NewIssueforRule(RuleKey ruleKey)TheRuleKeyof the issue.NewIssuegap(java.lang.Double gap)Gap used for the computation of the effort.NewIssueLocationnewLocation()Create a new location for this issue.NewQuickFixnewQuickFix()Create a new quick fix.NewIssueoverrideImpact(SoftwareQuality softwareQuality, Severity severity)Override severity of an impact defined by the rule.NewIssueoverrideSeverity(Severity severity)Override severity of the issue.voidsave()Save the issue.NewIssuesetCodeVariants(java.lang.Iterable<java.lang.String> codeVariants)Registers a list of code variants for this issue.NewIssuesetInternalTags(java.util.Collection<java.lang.String> tags)Set the internal tags for this issue.NewIssuesetQuickFixAvailable(boolean quickFixAvailable)Register if a QuickFix would be available on SonarLint for this issue.NewIssuesetRuleDescriptionContextKey(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
NewIssue overrideSeverity(@Nullable Severity severity)
Override 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
-
addInternalTag
NewIssue addInternalTag(java.lang.String tag)
Register an internal tag for this issue.- Parameters:
tag- a String tag- Since:
- 13.1
-
addInternalTags
NewIssue addInternalTags(java.util.Collection<java.lang.String> tags)
Register a collection of internal tags for this issue.- Parameters:
tag- a Collection of String tags- Since:
- 13.1
-
setInternalTags
NewIssue setInternalTags(@Nullable java.util.Collection<java.lang.String> tags)
Set the internal tags for this issue. This will override any previously set internal tags.- Parameters:
tags- a Collection of String tags- Since:
- 13.1
-
-