Skip to content

Commit

Permalink
Merge branch 'main' into gitlab_support
Browse files Browse the repository at this point in the history
Signed-off-by: Nathaniel Wert <[email protected]>
  • Loading branch information
N8BWert authored Sep 21, 2022
2 parents 6b45307 + a6983ed commit cf83b48
Show file tree
Hide file tree
Showing 48 changed files with 895 additions and 655 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# review when someone opens a pull request.
# TODO(owners): For ease of management, this should eventually shift to a
# defined GitHub team instead of individual usernames
* @azeemshaikh38 @justaugustus @laurentsimon @naveensrinivasan
* @azeemshaikh38 @justaugustus @laurentsimon @naveensrinivasan @spencerschrock

# Docs
# TODO(owners): For ease of management, this should eventually shift to a
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@b398f525a5587552e573b247ac661067fafa920b # v1
uses: github/codeql-action/init@904260d7d935dff982205cbdb42025ce30b7a34f # v1
with:
languages: ${{ matrix.language }}
queries: +security-extended
Expand All @@ -73,7 +73,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@b398f525a5587552e573b247ac661067fafa920b # v1
uses: github/codeql-action/autobuild@904260d7d935dff982205cbdb42025ce30b7a34f # v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -87,4 +87,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b398f525a5587552e573b247ac661067fafa920b # v1
uses: github/codeql-action/analyze@904260d7d935dff982205cbdb42025ce30b7a34f # v1
2 changes: 1 addition & 1 deletion .github/workflows/depsreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: 'Dependency Review'
uses: actions/dependency-review-action@23d1ffffb6fa5401173051ec21eba8c35242733f
uses: actions/dependency-review-action@2b96ea7f03d82de498e97b42e6bee3f7cb0dafaa
2 changes: 1 addition & 1 deletion .github/workflows/scorecard-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ jobs:
retention-days: 5

- name: "Upload SARIF results"
uses: github/codeql-action/upload-sarif@b398f525a5587552e573b247ac661067fafa920b # v1
uses: github/codeql-action/upload-sarif@904260d7d935dff982205cbdb42025ce30b7a34f # v1
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ results.json

# Output of the go coverage tool, specifically when used with LiteIDE.
*.coverprofile*
unit-coverage.out
**/unit-coverage.out
e2e-coverage.out


Expand Down
5 changes: 0 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ linters:
disable-all: true
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
- dogsled
Expand Down Expand Up @@ -50,17 +49,13 @@ linters:
- misspell
- nakedret
- nestif
- noctx
- nolintlint
- paralleltest
- predeclared
- staticcheck
- stylecheck
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ unit-test: ## Runs unit test without e2e
SKIP_GINKGO=1 go test -race -covermode=atomic -coverprofile=unit-coverage.out `go list ./...`

unit-test-attestor: ## Runs unit tests on scorecard-attestor
cd attestor; SKIP_GINKGO=1 go test -covermode=atomic -coverprofile=unit-coverage-attestor.out `go list ./...`; cd ..;
cd attestor; SKIP_GINKGO=1 go test -covermode=atomic -coverprofile=unit-coverage.out `go list ./...`; cd ..;

$(GINKGO): install

Expand All @@ -300,10 +300,10 @@ endif
e2e-pat: ## Runs e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to GitHub personal access token
e2e-pat: build-scorecard check-env | $(GINKGO)
# Run e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this
TOKEN_TYPE="PAT" $(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out ./...
TOKEN_TYPE="PAT" $(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out --keep-separate-coverprofiles ./...

e2e-gh-token: ## Runs e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to default GITHUB_TOKEN
e2e-gh-token: build-scorecard check-env | $(GINKGO)
# Run e2e tests. GITHUB_AUTH_TOKEN set to secrets.GITHUB_TOKEN must be used to run this.
TOKEN_TYPE="GITHUB_TOKEN" $(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out ./...
TOKEN_TYPE="GITHUB_TOKEN" $(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out --keep-separate-coverprofiles ./...
###############################################################################
3 changes: 1 addition & 2 deletions attestor/attestation_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ func (a AttestationPolicy) ToJSON() string {
func TestCheckPreventBinaryArtifacts(t *testing.T) {
t.Parallel()

dl := scut.TestDetailLogger{}

tests := []struct {
name string
raw *checker.RawResults
Expand Down Expand Up @@ -107,6 +105,7 @@ func TestCheckPreventBinaryArtifacts(t *testing.T) {
tt := &tests[i]
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
dl := scut.TestDetailLogger{}
actual, err := CheckPreventBinaryArtifacts(tt.allowedBinaryArtifacts, tt.raw, &dl)

if !errors.Is(err, tt.err) {
Expand Down
2 changes: 2 additions & 0 deletions checker/check_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const (
)

// CheckResult captures result from a check run.
//
//nolint:govet
type CheckResult struct {
Name string
Expand Down Expand Up @@ -94,6 +95,7 @@ type CheckDetail struct {

// LogMessage is a structure that encapsulates detail's information.
// This allows updating the definition easily.
//
//nolint:govet
type LogMessage struct {
Text string // A short string explaining why the detail was recorded/logged.
Expand Down
17 changes: 16 additions & 1 deletion checker/raw_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,22 @@ type LicenseData struct {
// CodeReviewData contains the raw results
// for the Code-Review check.
type CodeReviewData struct {
DefaultBranchCommits []clients.Commit
DefaultBranchChangesets []Changeset
}
type ReviewPlatform = string

const (
ReviewPlatformGitHub ReviewPlatform = "GitHub"
ReviewPlatformProw ReviewPlatform = "Prow"
ReviewPlatformGerrit ReviewPlatform = "Gerrit"
ReviewPlatformPhabricator ReviewPlatform = "Phabricator"
ReviewPlatformPiper ReviewPlatform = "Piper"
)

type Changeset struct {
ReviewPlatform string
RevisionID string
Commits []clients.Commit
}

// ContributorsData represents contributor information.
Expand Down
2 changes: 1 addition & 1 deletion checks/code_review_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func TestCodereview(t *testing.T) {
},
},
expected: checker.CheckResult{
Score: 0,
Score: checker.MaxResultScore,
},
},
{
Expand Down
Loading

0 comments on commit cf83b48

Please sign in to comment.