Skip to content

Commit

Permalink
refactor: configuration is injected
Browse files Browse the repository at this point in the history
  • Loading branch information
teodora-sandu committed Mar 26, 2024
1 parent d1de07a commit 7984072
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/segmentio/analytics-go v3.1.0+incompatible
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/snyk/code-client-go v1.0.0
github.com/snyk/code-client-go v1.0.1
github.com/snyk/go-application-framework v0.0.0-20240111143643-fa847b8a9a3b
github.com/sourcegraph/go-lsp v0.0.0-20240223163137-f80c5dd31dfd
github.com/stretchr/testify v1.8.4
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
Expand Down Expand Up @@ -307,10 +307,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/snyk/code-client-go v0.4.2 h1:xxdRgmvrJmIwEnJPv6Jzi4jnypsjN2j2gSkneRmgA4M=
github.com/snyk/code-client-go v0.4.2/go.mod h1:h+4316SCrU7i2WzTYcEdwH8XxjJgGVWfuFXazXGG5VA=
github.com/snyk/code-client-go v1.0.0 h1:/EoDkXMSRahxhlGeGevIpe9y0y87+kQEhqresY4Vp7U=
github.com/snyk/code-client-go v1.0.0/go.mod h1:+1AS/NlWgDcyJcl/2yOPmrvMhg27Lh5uDCSOFWkdDsg=
github.com/snyk/code-client-go v1.0.1 h1:zs1kAY4BFoob9z0TafEmnS3lJsoM1cCpjncU+8vyEIo=
github.com/snyk/code-client-go v1.0.1/go.mod h1:+1AS/NlWgDcyJcl/2yOPmrvMhg27Lh5uDCSOFWkdDsg=
github.com/snyk/go-application-framework v0.0.0-20240111143643-fa847b8a9a3b h1:8fFjcaUZpjLV06AtIqtB7QRMYBH/5dxv2CJp319q2Gs=
github.com/snyk/go-application-framework v0.0.0-20240111143643-fa847b8a9a3b/go.mod h1:Yz/qxFyfhf0xbA+z8Vzr5IM9IDG+BS+2PiGaP1yAsEw=
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65 h1:CEQuYv0Go6MEyRCD3YjLYM2u3Oxkx8GpCpFBd4rUTUk=
Expand Down
4 changes: 1 addition & 3 deletions infrastructure/code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,7 @@ func (sc *Scanner) UploadAndAnalyzeWithIgnores(ctx context.Context,
files <-chan string,
changedFiles map[string]bool,
) (issues []snyk.Issue, err error) {
c := config.CurrentConfig()

response, bundle, err := sc.codeScanner.UploadAndAnalyze(ctx, c.SnykCodeApi(), path, files, changedFiles)
response, bundle, err := sc.codeScanner.UploadAndAnalyze(ctx, path, files, changedFiles)
if ctx.Err() != nil {
log.Info().Msg("Canceling Code scan - Code scanner received cancellation signal")
return []snyk.Issue{}, nil
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/code/fake_code_client_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func getSarifResponseJson2(filePath string) string {
`, filePath, filePath, filePath, filePath, filePath)
}

func (f *FakeCodeScannerClient) UploadAndAnalyze(ctx context.Context, host string, path string, files <-chan string,
func (f *FakeCodeScannerClient) UploadAndAnalyze(ctx context.Context, path string, files <-chan string,
changedFiles map[string]bool) (*codeClientSarif.SarifResponse,
codeClientBundle.Bundle, error) {
var analysisResponse codeClientSarif.SarifResponse
Expand All @@ -400,7 +400,7 @@ type FakeBundle struct {
rootPath string
}

func (f FakeBundle) UploadBatch(ctx context.Context, host string, batch *codeClientBundle.Batch) error {
func (f FakeBundle) UploadBatch(ctx context.Context, batch *codeClientBundle.Batch) error {
return nil
}

Expand Down

0 comments on commit 7984072

Please sign in to comment.