Skip to content

Commit

Permalink
✨ Refactors code that deals with condition response and violations (k…
Browse files Browse the repository at this point in the history
…onveyor#298)

This pull request addresses issue konveyor#235 .
Removes unused code that was redundant as it's functionality was handled
by other elements. Actually, the `links` field in `IncidentContext`
draws it's value from `rule`, and as `rule` is also passed to
`createViolations` function, we can derive the `links` in the function
itself. So, the `links` field within `IncidentContext` is currently
unused throughout the source code; its primary role was to transfer this
value to `violations`, which is handled by `rule`. With your approval,
we can safely remove this field to enhance code clarity.
@pranavgaikwad please check

Signed-off-by: AdiAkhileshSingh15 <[email protected]>
  • Loading branch information
AdiAkhileshSingh15 authored Aug 23, 2023
1 parent 8af6167 commit 2f15552
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,6 @@ func (r *ruleEngine) createViolation(conditionResponse ConditionResponse, rule R
lineNumber := *m.LineNumber
incident.LineNumber = &lineNumber
}
links := []konveyor.Link{}
if len(m.Links) > 0 {
for _, l := range m.Links {
links = append(links, konveyor.Link{
URL: l.URL,
Title: l.Title,
})
}
}
// Some violations may not have a location in code.
limitSnip := (r.codeSnipLimit != 0 && fileCodeSnipCount[string(m.FileURI)] == r.codeSnipLimit)
if !limitSnip {
Expand Down

0 comments on commit 2f15552

Please sign in to comment.