Skip to content

Commit

Permalink
fix static, format
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Feb 4, 2025
1 parent 2516eb9 commit 69882ca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
5 changes: 1 addition & 4 deletions commands/git/audit/diffmode.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ func filterResultsNotInDiff(scanResults *results.SecurityCommandResults, changes
}

func getDescriptorsFromDiff(diffTargets []string) (descriptors []string) {
for _, target := range diffTargets {
descriptors = append(descriptors, target)
}
return
return append(descriptors, diffTargets...)
}

// Filter SCA results that are not in the diff, if at least one SCA descriptor is in the diff, the target is in the diff
Expand Down
2 changes: 1 addition & 1 deletion commands/git/audit/gitaudit.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func getDiffTargets(params GitAuditParams) (changes *gitutils.ChangesRelevantToS
if relevantChanges, err := gitManager.ScanRelevantDiff(params.diffTarget); err == nil {
changes = &relevantChanges
}
return
return
}

func (gaCmd *GitAuditCommand) getResultWriter(cmdResults *results.SecurityCommandResults) *output.ResultsWriter {
Expand Down
2 changes: 1 addition & 1 deletion utils/gitutils/filediff.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func detectRelevantChanges(filePatches []goDiff.FilePatch) (changes ChangesRelev
return
}

func processFileChunksForRelevantChanges(fileChunks []goDiff.Chunk, isNewFile bool) (changes []Range) {
func processFileChunksForRelevantChanges(fileChunks []goDiff.Chunk /*isNewFile*/, _ bool) (changes []Range) {
// SARIF locations start at 1
// row, col := 1, 1
for _, diffChunk := range fileChunks {
Expand Down
3 changes: 1 addition & 2 deletions utils/gitutils/filediff_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package gitutils

import (
)
import ()
11 changes: 5 additions & 6 deletions utils/gitutils/gitmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,16 @@ func TestGetGitProject(t *testing.T) {
}
}


func TestDetectRelevantChanges(t *testing.T) {
testCases := []struct {
name string
testZipDir string
name string
testZipDir string
targetReference string
expectedChanges ChangesRelevantToScan
}{
{
name: "No relevant changes",
testZipDir: "clean",
name: "No relevant changes",
testZipDir: "clean",
targetReference: "861b7aff93eeb9be4806f1d9cc668e3d702d90b6",
expectedChanges: ChangesRelevantToScan{},
},
Expand All @@ -242,4 +241,4 @@ func TestDetectRelevantChanges(t *testing.T) {
assert.Equal(t, testCase.expectedChanges, changes)
})
}
}
}

0 comments on commit 69882ca

Please sign in to comment.