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 int
MESSAGE_MAX_SIZE
Maximum number of characters in the message.static java.lang.String
RESOLUTION_FALSE_POSITIVE
Resolution when issue is flagged as false positive.static java.lang.String
RESOLUTION_FIXED
static java.lang.String
RESOLUTION_REMOVED
Resolution when rule has been uninstalled or disabled in the Quality profile.static java.lang.String
RESOLUTION_SAFE
Security Hotspot has been reviewed and resolved as safe.static java.lang.String
RESOLUTION_WONT_FIX
Issue is irrelevant in the context and was muted by user.static java.util.List<java.lang.String>
RESOLUTIONS
static java.util.List<java.lang.String>
SECURITY_HOTSPOT_RESOLUTIONS
static java.lang.String
STATUS_CLOSED
static java.lang.String
STATUS_CONFIRMED
static java.lang.String
STATUS_IN_REVIEW
Deprecated.since 8.1, status has been mapped as `TO_REVIEW`static java.lang.String
STATUS_OPEN
Default status when creating an issue.static java.lang.String
STATUS_REOPENED
static java.lang.String
STATUS_RESOLVED
static java.lang.String
STATUS_REVIEWED
static java.lang.String
STATUS_TO_REVIEW
static java.util.List<java.lang.String>
STATUSES
Return all available statuses
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.String
assignee()
UUID of the user who is assigned to this issue.java.lang.String
attribute(java.lang.String key)
java.util.Map<java.lang.String,java.lang.String>
attributes()
Empty on batch side since version 5.2.java.lang.String
authorLogin()
Login of the SCM account that introduced this issue.java.util.Date
closeDate()
Date when status was set toSTATUS_CLOSED
, else null.java.util.List<IssueComment>
comments()
Deprecated.since 7.2, comments are not more availablejava.lang.String
componentKey()
Components are modules ("my_project"), directories ("my_project:my/dir") or files ("my_project:my/file.c").java.lang.String
componentUuid()
java.util.Date
creationDate()
Duration
effort()
java.lang.Double
gap()
Arbitrary distance to threshold for resolving the issue.boolean
isCopied()
During a scan returns true if the issue is copied from another branch.boolean
isNew()
During a scan return if the current issue is a new one.java.lang.String
key()
Unique generated key.java.lang.String
language()
java.lang.Integer
line()
Optional line number.java.lang.String
message()
java.lang.String
projectKey()
java.lang.String
projectUuid()
java.lang.String
resolution()
The type of resolution, or null if the issue is not resolved.RuleKey
ruleKey()
java.lang.String
severity()
See constants inSeverity
.java.lang.String
status()
See constant values inIssue
.java.util.Collection<java.lang.String>
tags()
java.util.Date
updateDate()
-
-
-
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
-
RESOLUTION_SAFE
static final java.lang.String RESOLUTION_SAFE
Security Hotspot has been reviewed and resolved as safe.- Since:
- 8.1
- See Also:
- Constant Field Values
-
RESOLUTIONS
static final java.util.List<java.lang.String> RESOLUTIONS
-
SECURITY_HOTSPOT_RESOLUTIONS
static final java.util.List<java.lang.String> SECURITY_HOTSPOT_RESOLUTIONS
-
STATUS_TO_REVIEW
static final java.lang.String STATUS_TO_REVIEW
- Since:
- 7.8
- See Also:
- Constant Field Values
-
STATUS_IN_REVIEW
@Deprecated static final java.lang.String STATUS_IN_REVIEW
Deprecated.since 8.1, status has been mapped as `TO_REVIEW`- 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
-
-