Skip to content

Commit

Permalink
Add GolangCI static checks action and fix all found issues (#2011)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverdlov93 authored Jun 14, 2023
1 parent 60dd2e5 commit 37d3e4a
Show file tree
Hide file tree
Showing 35 changed files with 254 additions and 421 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
restore-keys: ${{ runner.os }}-go
- name: Run Go vet
run: go vet -v ./...

Static-Check:
name: Static Check ubuntu-latest
runs-on: ubuntu-latest
Expand All @@ -45,9 +46,11 @@ jobs:
with:
go-version: 1.20.x
- name: Static Code Analysis
uses: dominikh/staticcheck-action@v1
uses: golangci/golangci-lint-action@v3
with:
install-go: false
args: |
--timeout 5m --out-${NO_FUTURE}format colored-line-number --enable errcheck,gosimple,govet,ineffassign,staticcheck,typecheck,unused,gocritic,asasalint,asciicheck,errchkjson,exportloopref,forcetypeassert,makezero,nilerr,unparam,unconvert,wastedassign,usestdlibvars
Go-Sec:
name: Go-Sec ubuntu-latest
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestRefreshableAccessTokens(t *testing.T) {
// Upload a file and assert the refreshable tokens were generated.
artifactoryCommandExecutor := tests.NewJfrogCli(execMain, "jfrog rt", "")
uploadedFiles := 1
err = uploadWithSpecificServerAndVerify(t, artifactoryCommandExecutor, tests.ServerId, "testdata/a/a1.in", uploadedFiles)
err = uploadWithSpecificServerAndVerify(t, artifactoryCommandExecutor, "testdata/a/a1.in", uploadedFiles)
if !assert.NoError(t, err) {
return
}
Expand All @@ -80,23 +80,23 @@ func TestRefreshableAccessTokens(t *testing.T) {

// Upload a file and assert tokens were refreshed.
uploadedFiles++
err = uploadWithSpecificServerAndVerify(t, artifactoryCommandExecutor, tests.ServerId, "testdata/a/a2.in", uploadedFiles)
err = uploadWithSpecificServerAndVerify(t, artifactoryCommandExecutor, "testdata/a/a2.in", uploadedFiles)
if !assert.NoError(t, err) {
return
}
curAccessToken, curRefreshToken, err = assertTokensChanged(t, tests.ServerId, curAccessToken, curRefreshToken)
curAccessToken, curRefreshToken, err = assertTokensChanged(t, curAccessToken, curRefreshToken)
if !assert.NoError(t, err) {
return
}

// Make the token not refresh. Verify Tokens did not refresh.
auth.InviteRefreshBeforeExpiryMinutes = 0
uploadedFiles++
err = uploadWithSpecificServerAndVerify(t, artifactoryCommandExecutor, tests.ServerId, "testdata/a/b/b2.in", uploadedFiles)
err = uploadWithSpecificServerAndVerify(t, artifactoryCommandExecutor, "testdata/a/b/b2.in", uploadedFiles)
if !assert.NoError(t, err) {
return
}
newAccessToken, newRefreshToken, err := getArtifactoryTokensFromConfig(t, tests.ServerId)
newAccessToken, newRefreshToken, err := getArtifactoryTokensFromConfig(t)
if !assert.NoError(t, err) {
return
}
Expand Down
Loading

0 comments on commit 37d3e4a

Please sign in to comment.