Skip to content

Commit 5169159

Browse files
chore: list severity and category in issues list
Signed-off-by: Sourya Vatsyayan <sourya@deepsource.io>
1 parent e14eca3 commit 5169159

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

command/issues/list/list.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,12 @@ func (opts *IssuesListOptions) showIssues() {
213213
beginLine := issue.Location.Position.BeginLine
214214
issueLocation := fmt.Sprintf("%s:%d", filePath, beginLine)
215215
analyzerShortcode := issue.Analyzer.Shortcode
216+
issueCategory := issue.IssueCategory
217+
issueSeverity := issue.IssueSeverity
216218
issueCode := issue.IssueCode
217219
issueTitle := issue.IssueText
218220

219-
opts.ptermTable[index] = []string{issueLocation, analyzerShortcode, issueCode, issueTitle}
221+
opts.ptermTable[index] = []string{issueLocation, analyzerShortcode, issueCode, issueTitle, issueCategory, issueSeverity}
220222
}
221223
// Using pterm to render the list of list
222224
pterm.DefaultTable.WithSeparator("\t").WithData(opts.ptermTable).Render()

deepsource/issues/issues_list.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ type AnalyzerMeta struct {
1515
}
1616

1717
type Issue struct {
18-
IssueText string `json:"issue_title"` // The describing heading of the issue
19-
IssueCode string `json:"issue_code"` // DeepSource code for the issue reported
20-
Location Location `json:"location"` // The location data for the issue reported
21-
Analyzer AnalyzerMeta // The Analyzer which raised the issue
18+
IssueText string `json:"issue_title"` // The describing heading of the issue
19+
IssueCode string `json:"issue_code"` // DeepSource code for the issue reported
20+
IssueCategory string `json:"issue_category"` // Category of the issue reported
21+
IssueSeverity string `json:"issue_severity"` // Severity of the issue reported
22+
Location Location `json:"location"` // The location data for the issue reported
23+
Analyzer AnalyzerMeta // The Analyzer which raised the issue
2224
}

deepsource/issues/queries/list_issues.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const fetchAllIssuesQuery = `query GetAllIssues(
2929
title
3030
shortcode
3131
category
32+
severity
3233
isRecommended
3334
analyzer {
3435
name
@@ -70,6 +71,7 @@ type IssuesListResponse struct {
7071
Title string `json:"title"`
7172
Shortcode string `json:"shortcode"`
7273
Category string `json:"category"`
74+
Severity string `json:"severity"`
7375
IsRecommended bool `json:"isRecommended"`
7476
Analyzer struct {
7577
Name string `json:"name"`
@@ -105,16 +107,17 @@ func (i IssuesListRequest) Do(ctx context.Context, client IGQLClient) ([]issues.
105107
}
106108

107109
issuesData := []issues.Issue{}
108-
issueData := issues.Issue{}
109110
for _, edge := range respData.Repository.Issues.Edges {
110111
if len(edge.Node.Occurrences.Edges) == 0 {
111112
continue
112113
}
113114

114115
for _, occurenceEdge := range edge.Node.Occurrences.Edges {
115-
issueData = issues.Issue{
116-
IssueText: occurenceEdge.Node.Issue.Title,
117-
IssueCode: occurenceEdge.Node.Issue.Shortcode,
116+
issueData := issues.Issue{
117+
IssueText: occurenceEdge.Node.Issue.Title,
118+
IssueCode: occurenceEdge.Node.Issue.Shortcode,
119+
IssueCategory: occurenceEdge.Node.Issue.Category,
120+
IssueSeverity: occurenceEdge.Node.Issue.Severity,
118121
Location: issues.Location{
119122
Path: occurenceEdge.Node.Path,
120123
Position: issues.Position{

0 commit comments

Comments
 (0)