mirror of
https://github.com/ossf/scorecard.git
synced 2024-10-26 10:28:10 +03:00
1c3d9eb6e7
* 🌱 Migrate Maintained check to probes
Signed-off-by: AdamKorcz <adam@adalogics.com>
* fix typos
Signed-off-by: AdamKorcz <adam@adalogics.com>
* rename 'archived' probe to 'notArchvied
Signed-off-by: AdamKorcz <adam@adalogics.com>
* remove part of comment
Signed-off-by: AdamKorcz <adam@adalogics.com>
* fix typo
Signed-off-by: AdamKorcz <adam@adalogics.com>
* log negative findings
Signed-off-by: AdamKorcz <adam@adalogics.com>
* log non positive findings if repo was created less than 90 days ago
Signed-off-by: AdamKorcz <adam@adalogics.com>
* rename probe from 'activityOnIssuesByCollaboratorsMembersOrOwnersInLast90Days' to 'issueActivityByProjectMember'
Signed-off-by: AdamKorcz <adam@adalogics.com>
* change probe descriptions
Signed-off-by: AdamKorcz <adam@adalogics.com>
* rename 'wasCreatedInLast90Days' probe to 'notCreatedInLast90Days'
Signed-off-by: AdamKorcz <adam@adalogics.com>
* Add tests with zero issues
Signed-off-by: AdamKorcz <adam@adalogics.com>
* use values instead of returning multiple findings
Signed-off-by: AdamKorcz <adam@adalogics.com>
* return negative findings instead of non-positive
Signed-off-by: AdamKorcz <adam@adalogics.com>
* correct 'notCreatedInLast90Days' probe definition
Signed-off-by: AdamKorcz <adam@adalogics.com>
* make nested conditionals a single line
Signed-off-by: AdamKorcz <adam@adalogics.com>
* make nested conditionals a single line
Signed-off-by: AdamKorcz <adam@adalogics.com>
* change var name 'issuesUpdatedWithinThreshold' to 'numberOfIssuesUpdatedWithinThreshold'
Signed-off-by: AdamKorcz <adam@adalogics.com>
* rename 'notCreatedInLast90Days' to 'notCreatedRecently'
Signed-off-by: AdamKorcz <adam@adalogics.com>
* explain 'commitsWithinThreshold' in probe definition
Signed-off-by: AdamKorcz <adam@adalogics.com>
* rename 'commitsInLast90Days' to 'hasRecentCommits'" -s
Signed-off-by: AdamKorcz <adam@adalogics.com>
* fix linter issues
Signed-off-by: AdamKorcz <adam@adalogics.com>
* define 'numberOfIssuesUpdatedWithinThreshold'
Signed-off-by: AdamKorcz <adam@adalogics.com>
---------
Signed-off-by: AdamKorcz <adam@adalogics.com>
59 lines
1.8 KiB
Go
59 lines
1.8 KiB
Go
// Copyright 2020 OpenSSF Scorecard Authors
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package checks
|
|
|
|
import (
|
|
"github.com/ossf/scorecard/v4/checker"
|
|
"github.com/ossf/scorecard/v4/checks/evaluation"
|
|
"github.com/ossf/scorecard/v4/checks/raw"
|
|
sce "github.com/ossf/scorecard/v4/errors"
|
|
"github.com/ossf/scorecard/v4/probes"
|
|
"github.com/ossf/scorecard/v4/probes/zrunner"
|
|
)
|
|
|
|
// CheckMaintained is the exported check name for Maintained.
|
|
const CheckMaintained = "Maintained"
|
|
|
|
//nolint:gochecknoinits
|
|
func init() {
|
|
if err := registerCheck(CheckMaintained, Maintained, nil); err != nil {
|
|
// this should never happen
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// Maintained runs Maintained check.
|
|
func Maintained(c *checker.CheckRequest) checker.CheckResult {
|
|
rawData, err := raw.Maintained(c)
|
|
if err != nil {
|
|
e := sce.WithMessage(sce.ErrScorecardInternal, err.Error())
|
|
return checker.CreateRuntimeErrorResult(CheckMaintained, e)
|
|
}
|
|
|
|
// Set the raw results.
|
|
pRawResults := getRawResults(c)
|
|
pRawResults.MaintainedResults = rawData
|
|
|
|
// Evaluate the probes.
|
|
findings, err := zrunner.Run(pRawResults, probes.Maintained)
|
|
if err != nil {
|
|
e := sce.WithMessage(sce.ErrScorecardInternal, err.Error())
|
|
return checker.CreateRuntimeErrorResult(CheckMaintained, e)
|
|
}
|
|
|
|
// Return the score evaluation.
|
|
return evaluation.Maintained(CheckMaintained, findings, c.Dlogger)
|
|
}
|