Package org.sonar.api.issue
Interface Issue
-
- All Superinterfaces:
java.io.Serializable
public interface Issue extends java.io.Serializable- Since:
- 3.6
-
-
Field Summary
Fields Modifier and Type Field Description static intMESSAGE_MAX_SIZEMaximum number of characters in the message.static java.lang.StringRESOLUTION_FALSE_POSITIVEResolution when issue is flagged as false positive.static java.lang.StringRESOLUTION_FIXEDstatic java.lang.StringRESOLUTION_REMOVEDResolution when rule has been uninstalled or disabled in the Quality profile.static java.lang.StringRESOLUTION_WONT_FIXIssue is irrelevant in the context and was muted by user.static java.util.List<java.lang.String>RESOLUTIONSstatic java.lang.StringSTATUS_CLOSEDstatic java.lang.StringSTATUS_CONFIRMEDstatic java.lang.StringSTATUS_IN_REVIEWstatic java.lang.StringSTATUS_OPENDefault status when creating an issue.static java.lang.StringSTATUS_REOPENEDstatic java.lang.StringSTATUS_RESOLVEDstatic java.lang.StringSTATUS_REVIEWEDstatic java.lang.StringSTATUS_TO_REVIEWstatic java.util.List<java.lang.String>STATUSESReturn all available statuses
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.Stringassignee()UUID of the user who is assigned to this issue.java.lang.Stringattribute(java.lang.String key)java.util.Map<java.lang.String,java.lang.String>attributes()Empty on batch side since version 5.2.java.lang.StringauthorLogin()Login of the SCM account that introduced this issue.java.util.DatecloseDate()Date when status was set toSTATUS_CLOSED, else null.java.util.List<IssueComment>comments()Deprecated.since 7.2, comments are not more availablejava.lang.StringcomponentKey()Components are modules ("my_project"), directories ("my_project:my/dir") or files ("my_project:my/file.c").java.lang.StringcomponentUuid()java.util.DatecreationDate()Durationeffort()java.lang.Doublegap()Arbitrary distance to threshold for resolving the issue.booleanisCopied()During a scan returns true if the issue is copied from another branch.booleanisNew()During a scan return if the current issue is a new one.java.lang.Stringkey()Unique generated key.java.lang.Stringlanguage()java.lang.Integerline()Optional line number.java.lang.Stringmessage()java.lang.StringprojectKey()java.lang.StringprojectUuid()java.lang.Stringresolution()The type of resolution, or null if the issue is not resolved.RuleKeyruleKey()java.lang.Stringseverity()See constants inSeverity.java.lang.Stringstatus()See constant values inIssue.java.util.Collection<java.lang.String>tags()java.util.DateupdateDate()
-
-
-
Field Detail
-
MESSAGE_MAX_SIZE
static final int MESSAGE_MAX_SIZE
Maximum number of characters in the message. In theory it should be 4_000 UTF-8 characters but unfortunately Oracle DB does not support more than 4_000 bytes, even if column issues.message is created with type VARCHAR2(4000 CHAR). In order to have the same behavior on all databases, message is truncated to 4_000 / 3 (maximum bytes per UTF-8 character) = 1_333 characters.- See Also:
- Constant Field Values
-
STATUS_OPEN
static final java.lang.String STATUS_OPEN
Default status when creating an issue.- See Also:
- Constant Field Values
-
STATUS_CONFIRMED
static final java.lang.String STATUS_CONFIRMED
- See Also:
- Constant Field Values
-
STATUS_REOPENED
static final java.lang.String STATUS_REOPENED
- See Also:
- Constant Field Values
-
STATUS_RESOLVED
static final java.lang.String STATUS_RESOLVED
- See Also:
- Constant Field Values
-
STATUS_CLOSED
static final java.lang.String STATUS_CLOSED
- See Also:
- Constant Field Values
-
RESOLUTION_FIXED
static final java.lang.String RESOLUTION_FIXED
- See Also:
- Constant Field Values
-
RESOLUTION_FALSE_POSITIVE
static final java.lang.String RESOLUTION_FALSE_POSITIVE
Resolution when issue is flagged as false positive.- See Also:
- Constant Field Values
-
RESOLUTION_REMOVED
static final java.lang.String RESOLUTION_REMOVED
Resolution when rule has been uninstalled or disabled in the Quality profile.- See Also:
- Constant Field Values
-
RESOLUTION_WONT_FIX
static final java.lang.String RESOLUTION_WONT_FIX
Issue is irrelevant in the context and was muted by user.- Since:
- 5.1
- See Also:
- Constant Field Values
-
RESOLUTIONS
static final java.util.List<java.lang.String> RESOLUTIONS
-
STATUS_TO_REVIEW
static final java.lang.String STATUS_TO_REVIEW
- Since:
- 7.8
- See Also:
- Constant Field Values
-
STATUS_IN_REVIEW
static final java.lang.String STATUS_IN_REVIEW
- Since:
- 7.8
- See Also:
- Constant Field Values
-
STATUS_REVIEWED
static final java.lang.String STATUS_REVIEWED
- Since:
- 7.8
- See Also:
- Constant Field Values
-
STATUSES
static final java.util.List<java.lang.String> STATUSES
Return all available statuses- Since:
- 4.4
-
-
Method Detail
-
key
java.lang.String key()
Unique generated key. It looks like "d2de809c-1512-4ae2-9f34-f5345c9f1a13".
-
componentKey
java.lang.String componentKey()
Components are modules ("my_project"), directories ("my_project:my/dir") or files ("my_project:my/file.c"). Keys of Java packages and classes are currently in a special format: "my_project:com.company" and "my_project:com.company.Foo".
-
ruleKey
RuleKey ruleKey()
-
language
java.lang.String language()
-
severity
java.lang.String severity()
See constants inSeverity.
-
message
@CheckForNull java.lang.String message()
-
line
@CheckForNull java.lang.Integer line()
Optional line number. If set, then it's greater than or equal 1.
-
gap
@CheckForNull java.lang.Double gap()
Arbitrary distance to threshold for resolving the issue.
For examples:- for the rule "Avoid too complex methods" : current complexity - max allowed complexity
- for the rule "Avoid Duplications" : number of duplicated blocks
- for the rule "Insufficient Line Coverage" : number of lines to cover to reach the accepted threshold
- Since:
- 5.5
-
status
java.lang.String status()
See constant values inIssue.
-
resolution
@CheckForNull java.lang.String resolution()
The type of resolution, or null if the issue is not resolved. See constant values inIssue.
-
assignee
@CheckForNull java.lang.String assignee()
UUID of the user who is assigned to this issue. Null if the issue is not assigned.
-
creationDate
java.util.Date creationDate()
-
updateDate
java.util.Date updateDate()
-
closeDate
@CheckForNull java.util.Date closeDate()
Date when status was set toSTATUS_CLOSED, else null.
-
attribute
@CheckForNull java.lang.String attribute(java.lang.String key)
-
attributes
java.util.Map<java.lang.String,java.lang.String> attributes()
Empty on batch side since version 5.2. Attributes are moved to server's Compute Engine. No use-case for keeping them on batch side for now
-
authorLogin
@CheckForNull java.lang.String authorLogin()
Login of the SCM account that introduced this issue. Requires the Developer Cockpit Plugin to be installed.
-
comments
@Deprecated java.util.List<IssueComment> comments()
Deprecated.since 7.2, comments are not more availableNon-null list of comments, ordered by chronological order.
-
isNew
boolean isNew()
During a scan return if the current issue is a new one.- Returns:
- always false on server side
- Since:
- 4.0
-
isCopied
boolean isCopied()
During a scan returns true if the issue is copied from another branch.- Since:
- 6.6
-
effort
@CheckForNull Duration effort()
- Since:
- 5.5
-
projectKey
java.lang.String projectKey()
- Since:
- 5.0
-
projectUuid
java.lang.String projectUuid()
- Since:
- 5.0
-
componentUuid
java.lang.String componentUuid()
- Since:
- 5.0
-
tags
java.util.Collection<java.lang.String> tags()
- Since:
- 5.1
-
-