mirror of
https://github.com/ossf/scorecard.git
synced 2024-10-26 10:28:10 +03:00
parent
f2209240a7
commit
5476b878bd
@ -20,7 +20,6 @@ linters:
|
||||
- deadcode
|
||||
- depguard
|
||||
- dogsled
|
||||
- dupl
|
||||
- errcheck
|
||||
- errorlint
|
||||
- exhaustive
|
||||
@ -38,7 +37,6 @@ linters:
|
||||
- gofumpt
|
||||
- goheader
|
||||
- goimports
|
||||
- gomnd
|
||||
- gomodguard
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
@ -53,7 +51,6 @@ linters:
|
||||
- noctx
|
||||
- nolintlint
|
||||
- paralleltest
|
||||
- prealloc
|
||||
- predeclared
|
||||
- revive
|
||||
- rowserrcheck
|
||||
|
@ -169,7 +169,6 @@ func CreateResultWithScore(name, reason string, score int) CheckResult {
|
||||
Confidence: MaxResultScore,
|
||||
Pass: pass,
|
||||
// New structure.
|
||||
//nolint
|
||||
Version: 2,
|
||||
Error2: nil,
|
||||
Score: score,
|
||||
@ -195,7 +194,6 @@ func CreateProportionalScoreResult(name, reason string, b, t int) CheckResult {
|
||||
Confidence: MaxResultConfidence,
|
||||
Pass: pass,
|
||||
// New structure.
|
||||
//nolint
|
||||
Version: 2,
|
||||
Error2: nil,
|
||||
Score: score,
|
||||
@ -227,7 +225,6 @@ func CreateInconclusiveResult(name, reason string) CheckResult {
|
||||
Confidence: 0,
|
||||
Pass: false,
|
||||
// New structure.
|
||||
//nolint
|
||||
Version: 2,
|
||||
Score: InconclusiveResultScore,
|
||||
Reason: reason,
|
||||
@ -243,7 +240,6 @@ func CreateRuntimeErrorResult(name string, e error) CheckResult {
|
||||
Confidence: 0,
|
||||
Pass: false,
|
||||
// New structure.
|
||||
//nolint
|
||||
Version: 2,
|
||||
Error2: e,
|
||||
Score: InconclusiveResultScore,
|
||||
|
@ -272,7 +272,6 @@ func validateDockerfileIsFreeOfInsecureDownloads(pathfn string, content []byte,
|
||||
return false, sce.Create(sce.ErrScorecardInternal, fmt.Sprintf("%v: %v", errInternalInvalidDockerFile, err))
|
||||
}
|
||||
|
||||
// nolint: prealloc
|
||||
var bytes []byte
|
||||
|
||||
// Walk the Dockerfile's AST.
|
||||
|
@ -375,7 +375,7 @@ func isGoUnpinnedDownload(cmd []string) bool {
|
||||
|
||||
// `Go install` will automatically look up the
|
||||
// go.mod and go.sum, so we don't flag it.
|
||||
// nolint: gomnd
|
||||
|
||||
if len(cmd) <= 2 {
|
||||
return false
|
||||
}
|
||||
@ -396,7 +396,7 @@ func isGoUnpinnedDownload(cmd []string) bool {
|
||||
pkg := cmd[i+1]
|
||||
// Verify pkg = name@hash
|
||||
parts := strings.Split(pkg, "@")
|
||||
// nolint: gomnd
|
||||
|
||||
if len(parts) != 2 {
|
||||
continue
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ func (handler *checkrunsHandler) listCheckRunsForRef(ref string) ([]clients.Chec
|
||||
}
|
||||
|
||||
func checkRunsFrom(data *github.ListCheckRunsResults) []clients.CheckRun {
|
||||
// nolint: prealloc // https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
|
||||
var checkRuns []clients.CheckRun
|
||||
for _, checkRun := range data.CheckRuns {
|
||||
checkRuns = append(checkRuns, clients.CheckRun{
|
||||
|
@ -63,7 +63,6 @@ func (handler *releasesHandler) getReleases() ([]clients.Release, error) {
|
||||
}
|
||||
|
||||
func releasesFrom(data []*github.RepositoryRelease) []clients.Release {
|
||||
// nolint: prealloc // https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
|
||||
var releases []clients.Release
|
||||
for _, r := range data {
|
||||
release := clients.Release{
|
||||
|
@ -48,7 +48,6 @@ func (handler *statusesHandler) listStatuses(ref string) ([]clients.Status, erro
|
||||
}
|
||||
|
||||
func statusesFrom(data []*github.RepoStatus) []clients.Status {
|
||||
// nolint: prealloc // https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
|
||||
var statuses []clients.Status
|
||||
for _, status := range data {
|
||||
statuses = append(statuses, clients.Status{
|
||||
|
@ -139,7 +139,6 @@ func (handler *tarballHandler) getTarball(ctx context.Context, repo *github.Repo
|
||||
|
||||
// nolint: gocognit
|
||||
func (handler *tarballHandler) extractTarball() error {
|
||||
// nolint: gomnd
|
||||
in, err := os.OpenFile(handler.tempTarFile, os.O_RDONLY, 0o644)
|
||||
if err != nil {
|
||||
return fmt.Errorf("os.OpenFile: %w", err)
|
||||
@ -167,7 +166,7 @@ func (handler *tarballHandler) extractTarball() error {
|
||||
if dirpath == filepath.Clean(handler.tempDir) {
|
||||
continue
|
||||
}
|
||||
// nolint: gomnd
|
||||
|
||||
if err := os.Mkdir(dirpath, 0o755); err != nil {
|
||||
return fmt.Errorf("error during os.Mkdir: %w", err)
|
||||
}
|
||||
@ -181,7 +180,6 @@ func (handler *tarballHandler) extractTarball() error {
|
||||
}
|
||||
|
||||
if _, err := os.Stat(filepath.Dir(filenamepath)); os.IsNotExist(err) {
|
||||
// nolint: gomnd
|
||||
if err := os.Mkdir(filepath.Dir(filenamepath), 0o755); err != nil {
|
||||
return fmt.Errorf("os.Mkdir: %w", err)
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ func (handler *workflowsHandler) listSuccessfulWorkflowRuns(filename string) ([]
|
||||
}
|
||||
|
||||
func workflowsRunsFrom(data *github.WorkflowRuns) []clients.WorkflowRun {
|
||||
// nolint: prealloc // https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
|
||||
var workflowRuns []clients.WorkflowRun
|
||||
for _, workflowRun := range data.WorkflowRuns {
|
||||
workflowRuns = append(workflowRuns, clients.WorkflowRun{
|
||||
|
@ -90,11 +90,10 @@ func main() {
|
||||
ctx := context.Background()
|
||||
t := time.Now()
|
||||
|
||||
// nolint: gomnd
|
||||
if len(os.Args) != 2 {
|
||||
panic("must provide a single argument")
|
||||
}
|
||||
// nolint: gomnd
|
||||
|
||||
inFile, err := os.OpenFile(os.Args[1], os.O_RDONLY, 0o644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -32,11 +32,10 @@ import (
|
||||
// Args:
|
||||
// path to input.csv output.csv
|
||||
func main() {
|
||||
// nolint: gomnd
|
||||
if len(os.Args) != 3 {
|
||||
panic("must provide 2 arguments")
|
||||
}
|
||||
// nolint: gomnd
|
||||
|
||||
inFile, err := os.OpenFile(os.Args[1], os.O_RDONLY, 0o644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -55,7 +54,7 @@ func main() {
|
||||
if err := data.SortAndAppendTo(&buf, repoURLs, nil); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// nolint: gomnd
|
||||
|
||||
projects, err := os.OpenFile(os.Args[2], os.O_WRONLY|os.O_CREATE, 0o755)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -26,11 +26,10 @@ import (
|
||||
// Args:
|
||||
// file path to old_projects.csv new_projects.csv
|
||||
func main() {
|
||||
// nolint: gomnd
|
||||
if len(os.Args) != 3 {
|
||||
panic("must provide 2 arguments")
|
||||
}
|
||||
// nolint: gomnd
|
||||
|
||||
inFile, err := os.OpenFile(os.Args[1], os.O_RDONLY, 0o644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -46,7 +45,6 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// nolint: gomnd
|
||||
projects, err := os.OpenFile(os.Args[2], os.O_CREATE|os.O_WRONLY, 0o644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -26,11 +26,10 @@ import (
|
||||
// * Check for no duplicates in repoURLs.
|
||||
// * Check repoURL is a valid GitHub URL.
|
||||
func main() {
|
||||
// nolint: gomnd
|
||||
if len(os.Args) != 2 {
|
||||
panic("must provide single argument")
|
||||
}
|
||||
// nolint: gomnd
|
||||
|
||||
inFile, err := os.OpenFile(os.Args[1], os.O_RDONLY, 0o644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//nolint:dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// nolint: dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// nolint: dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// nolint: dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//nolint:dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// nolint: dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// nolint: dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -11,7 +11,6 @@
|
||||
// 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.
|
||||
//nolint:dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -11,7 +11,6 @@
|
||||
// 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.
|
||||
//nolint:dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -11,7 +11,6 @@
|
||||
// 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.
|
||||
//nolint:dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// nolint: dupl
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -34,9 +34,8 @@ func textToMarkdown(s string) string {
|
||||
|
||||
// DetailToString turns a detail information into a string.
|
||||
func DetailToString(d *checker.CheckDetail, logLevel zapcore.Level) string {
|
||||
// UPGRADEv3: remove swtch statement.
|
||||
// UPGRADEv3: remove switch statement.
|
||||
switch d.Msg.Version {
|
||||
//nolint
|
||||
case 3:
|
||||
if d.Type == checker.DetailDebug && logLevel != zapcore.DebugLevel {
|
||||
return ""
|
||||
|
Loading…
Reference in New Issue
Block a user