Skip to content

Commit

Permalink
fix: remove unused types
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawkyZ committed Oct 14, 2024
1 parent 2d376c8 commit 375cfbd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 85 deletions.
69 changes: 24 additions & 45 deletions domain/ide/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ func getOssIssue(issue snyk.Issue) types.ScanIssue {
IsUpgradable: matchingIssue.IsUpgradable,
ProjectName: matchingIssue.ProjectName,
DisplayTargetFile: matchingIssue.DisplayTargetFile,
Details: matchingIssue.Details,
}
}

Expand Down Expand Up @@ -272,7 +271,6 @@ func getOssIssue(issue snyk.Issue) types.ScanIssue {
IsUpgradable: additionalData.IsUpgradable,
ProjectName: additionalData.ProjectName,
DisplayTargetFile: additionalData.DisplayTargetFile,
Details: additionalData.Details,
MatchingIssues: matchingIssues,
Lesson: additionalData.Lesson,
},
Expand All @@ -297,16 +295,15 @@ func getIacIssue(issue snyk.Issue) types.ScanIssue {
IsNew: issue.IsNew,
FilterableIssueType: additionalData.GetFilterableIssueType(),
AdditionalData: types.IacIssueData{
Key: additionalData.Key,
PublicId: additionalData.PublicId,
Documentation: additionalData.Documentation,
LineNumber: additionalData.LineNumber,
Issue: additionalData.Issue,
Impact: additionalData.Impact,
Resolve: additionalData.Resolve,
Path: additionalData.Path,
References: additionalData.References,
CustomUIContent: additionalData.CustomUIContent,
Key: additionalData.Key,
PublicId: additionalData.PublicId,
Documentation: additionalData.Documentation,
LineNumber: additionalData.LineNumber,
Issue: additionalData.Issue,
Impact: additionalData.Impact,
Resolve: additionalData.Resolve,
Path: additionalData.Path,
References: additionalData.References,
},
}

Expand All @@ -319,22 +316,6 @@ func getCodeIssue(issue snyk.Issue) types.ScanIssue {
return types.ScanIssue{}
}

exampleCommitFixes := make([]types.ExampleCommitFix, 0, len(additionalData.ExampleCommitFixes))
for i := range additionalData.ExampleCommitFixes {
lines := make([]types.CommitChangeLine, 0, len(additionalData.ExampleCommitFixes[i].Lines))
for j := range additionalData.ExampleCommitFixes[i].Lines {
lines = append(lines, types.CommitChangeLine{
Line: additionalData.ExampleCommitFixes[i].Lines[j].Line,
LineNumber: additionalData.ExampleCommitFixes[i].Lines[j].LineNumber,
LineChange: additionalData.ExampleCommitFixes[i].Lines[j].LineChange,
})
}
exampleCommitFixes = append(exampleCommitFixes, types.ExampleCommitFix{
CommitURL: additionalData.ExampleCommitFixes[i].CommitURL,
Lines: lines,
})
}

markers := make([]types.Marker, 0, len(additionalData.Markers))
for _, marker := range additionalData.Markers {
positions := make([]types.MarkerPosition, 0)
Expand Down Expand Up @@ -374,23 +355,21 @@ func getCodeIssue(issue snyk.Issue) types.ScanIssue {
IsNew: issue.IsNew,
FilterableIssueType: additionalData.GetFilterableIssueType(),
AdditionalData: types.CodeIssueData{
Key: additionalData.Key,
Message: additionalData.Message,
Rule: additionalData.Rule,
RuleId: additionalData.RuleId,
RepoDatasetSize: additionalData.RepoDatasetSize,
ExampleCommitFixes: exampleCommitFixes,
CWE: additionalData.CWE,
IsSecurityType: additionalData.IsSecurityType,
Text: additionalData.Text,
Cols: additionalData.Cols,
Rows: additionalData.Rows,
PriorityScore: additionalData.PriorityScore,
Markers: markers,
LeadURL: "",
HasAIFix: additionalData.HasAIFix,
DataFlow: dataFlow,
Details: additionalData.Details,
Key: additionalData.Key,
Message: additionalData.Message,
Rule: additionalData.Rule,
RuleId: additionalData.RuleId,
RepoDatasetSize: additionalData.RepoDatasetSize,
CWE: additionalData.CWE,
IsSecurityType: additionalData.IsSecurityType,
Text: additionalData.Text,
Cols: additionalData.Cols,
Rows: additionalData.Rows,
PriorityScore: additionalData.PriorityScore,
Markers: markers,
LeadURL: "",
HasAIFix: additionalData.HasAIFix,
DataFlow: dataFlow,
},
}
if scanIssue.IsIgnored {
Expand Down
7 changes: 0 additions & 7 deletions infrastructure/code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,6 @@ func (sc *Scanner) enhanceIssuesDetails(issues []snyk.Issue, folderPath string)
} else if lesson != nil && lesson.Url != "" {
issue.LessonUrl = lesson.Url
}

renderer, err := NewHtmlRenderer(sc.c)
if err != nil {
sc.c.Logger().Err(err).Msg("Cannot create Oss HTML render")
return
}
issueData.Details = renderer.GetDetailsHtml(*issue, folderPath)
issue.AdditionalData = issueData
}
}
Expand Down
57 changes: 24 additions & 33 deletions internal/types/lsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,6 @@ type OssIssueData struct {
IsUpgradable bool `json:"isUpgradable"`
ProjectName string `json:"projectName"`
DisplayTargetFile string `json:"displayTargetFile"`
Details string `json:"details,omitempty"`
MatchingIssues []OssIssueData `json:"matchingIssues"`
Lesson string `json:"lessonUrl,omitempty"`
}
Expand All @@ -1136,32 +1135,25 @@ type DataflowElement struct {
}

type CodeIssueData struct {
Key string `json:"key,omitempty"`
Message string `json:"message"`
LeadURL string `json:"leadURL,omitempty"`
Rule string `json:"rule"`
RuleId string `json:"ruleId"`
RepoDatasetSize int `json:"repoDatasetSize"`
ExampleCommitFixes []ExampleCommitFix `json:"exampleCommitFixes"`
CWE []string `json:"cwe"`
Text string `json:"text"`
Markers []Marker `json:"markers,omitempty"`
Cols Point `json:"cols"`
Rows Point `json:"rows"`
IsSecurityType bool `json:"isSecurityType"`
PriorityScore int `json:"priorityScore"`
HasAIFix bool `json:"hasAIFix"`
DataFlow []DataflowElement `json:"dataFlow,omitempty"`
Details string `json:"details,omitempty"`
Key string `json:"key,omitempty"`
Message string `json:"message"`
LeadURL string `json:"leadURL,omitempty"`
Rule string `json:"rule"`
RuleId string `json:"ruleId"`
RepoDatasetSize int `json:"repoDatasetSize"`
CWE []string `json:"cwe"`
Text string `json:"text"`
Markers []Marker `json:"markers,omitempty"`
Cols Point `json:"cols"`
Rows Point `json:"rows"`
IsSecurityType bool `json:"isSecurityType"`
PriorityScore int `json:"priorityScore"`
HasAIFix bool `json:"hasAIFix"`
DataFlow []DataflowElement `json:"dataFlow,omitempty"`
}

type Point = [2]int

type ExampleCommitFix struct {
CommitURL string `json:"commitURL"`
Lines []CommitChangeLine `json:"lines"`
}

type CommitChangeLine struct {
Line string `json:"line"`
LineNumber int `json:"lineNumber"`
Expand All @@ -1188,14 +1180,13 @@ type CodeActionOptions struct {
}

type IacIssueData struct {
Key string `json:"key,omitempty"`
PublicId string `json:"publicId"`
Documentation string `json:"documentation"`
LineNumber int `json:"lineNumber"`
Issue string `json:"issue"`
Impact string `json:"impact"`
Resolve string `json:"resolve,omitempty"`
Path []string `json:"path"`
References []string `json:"references,omitempty"`
CustomUIContent string `json:"customUIContent,omitempty"`
Key string `json:"key,omitempty"`
PublicId string `json:"publicId"`
Documentation string `json:"documentation"`
LineNumber int `json:"lineNumber"`
Issue string `json:"issue"`
Impact string `json:"impact"`
Resolve string `json:"resolve,omitempty"`
Path []string `json:"path"`
References []string `json:"references,omitempty"`
}

0 comments on commit 375cfbd

Please sign in to comment.