From 436c7ac6145052458058cfc4d0dae386b63446ff Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Wed, 13 Apr 2022 10:49:52 +0200 Subject: [PATCH] Fix scope and internall error handling (#145) --- internal/check/valid_owner.go | 1 + internal/runner/runner_worker.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/internal/check/valid_owner.go b/internal/check/valid_owner.go index b5b7d8a..cbe06f5 100644 --- a/internal/check/valid_owner.go +++ b/internal/check/valid_owner.go @@ -375,6 +375,7 @@ func (*ValidOwner) checkRequiredScopes(header http.Header) error { gotScopes := strings.Split(header.Get(scopeHeader), ",") presentScope := map[github.Scope]struct{}{} for _, scope := range gotScopes { + scope = strings.TrimSpace(scope) presentScope[github.Scope(scope)] = struct{}{} } diff --git a/internal/runner/runner_worker.go b/internal/runner/runner_worker.go index 39074d1..49dce3c 100644 --- a/internal/runner/runner_worker.go +++ b/internal/runner/runner_worker.go @@ -95,6 +95,10 @@ func (r *CheckRunner) collectMetrics(checkOut check.Output, err error) { r.allFoundIssues[i.Severity]++ } + if err != nil { + r.allFoundIssues[check.Error]++ + } + if len(checkOut.Issues) > 0 || err != nil { r.notPassedChecksCnt++ }