mirror of
https://github.com/ossf/scorecard.git
synced 2024-09-11 08:55:27 +03:00
Add new linter: gci (#498)
This commit is contained in:
parent
587f41117b
commit
61ecad3151
@ -4,6 +4,8 @@ run:
|
||||
deadline: 5m
|
||||
issues:
|
||||
new-from-rev: ""
|
||||
skip-files:
|
||||
- cron/data/request.pb.go # autogenerated
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
@ -16,6 +18,7 @@ linters:
|
||||
- errcheck
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- gci
|
||||
- gochecknoinits
|
||||
- gocognit
|
||||
- goconst
|
||||
@ -71,6 +74,8 @@ linters-settings:
|
||||
- BUG
|
||||
- FIXME
|
||||
- HACK
|
||||
gci:
|
||||
local-prefixes: github.com/ossf/scorecard
|
||||
gocritic:
|
||||
enabled-checks:
|
||||
# Diagnostic
|
||||
|
@ -20,9 +20,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ossf/scorecard/stats"
|
||||
opencensusstats "go.opencensus.io/stats"
|
||||
"go.opencensus.io/tag"
|
||||
|
||||
"github.com/ossf/scorecard/stats"
|
||||
)
|
||||
|
||||
const checkRetries = 3
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -16,6 +16,7 @@ package checks
|
||||
|
||||
import (
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -21,8 +21,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/moby/buildkit/frontend/dockerfile/parser"
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
const frozenDepsStr = "Frozen-Deps"
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"errors"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
|
@ -17,8 +17,9 @@ package checks
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/shurcooL/githubv4"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
)
|
||||
|
||||
const (
|
||||
|
10
cmd/root.go
10
cmd/root.go
@ -18,6 +18,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
goflag "flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
@ -26,17 +27,16 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
goflag "flag"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
"github.com/shurcooL/githubv4"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
"github.com/ossf/scorecard/pkg"
|
||||
"github.com/ossf/scorecard/repos"
|
||||
"github.com/ossf/scorecard/roundtripper"
|
||||
"github.com/shurcooL/githubv4"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -23,13 +23,14 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
"github.com/shurcooL/githubv4"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/ossf/scorecard/checks"
|
||||
"github.com/ossf/scorecard/pkg"
|
||||
"github.com/ossf/scorecard/repos"
|
||||
"github.com/ossf/scorecard/roundtripper"
|
||||
"github.com/shurcooL/githubv4"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
//nolint:gochecknoinits
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"log"
|
||||
|
||||
"cloud.google.com/go/bigquery"
|
||||
|
||||
"github.com/ossf/scorecard/cron/config"
|
||||
)
|
||||
|
||||
|
@ -15,7 +15,9 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
_ "embed" // Used to embed config.yaml
|
||||
|
||||
// Used to embed config.yaml.
|
||||
_ "embed"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
@ -20,10 +20,11 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
|
||||
"github.com/ossf/scorecard/cron/config"
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
"github.com/ossf/scorecard/cron/pubsub"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
func PublishToRepoRequestTopic(ctx context.Context, iter data.Iterator, datetime time.Time) (int32, error) {
|
||||
|
@ -19,9 +19,12 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/ossf/scorecard/cron/config"
|
||||
"gocloud.dev/blob"
|
||||
_ "gocloud.dev/blob/gcsblob" // Needed to link in GCP drivers.
|
||||
|
||||
// Needed to link in GCP drivers.
|
||||
_ "gocloud.dev/blob/gcsblob"
|
||||
|
||||
"github.com/ossf/scorecard/cron/config"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/jszwec/csvutil"
|
||||
|
||||
"github.com/ossf/scorecard/repos"
|
||||
)
|
||||
|
||||
|
@ -28,6 +28,10 @@ import (
|
||||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
"github.com/google/go-github/v32/github"
|
||||
"github.com/jszwec/csvutil"
|
||||
"github.com/shurcooL/githubv4"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/ossf/scorecard/checks"
|
||||
"github.com/ossf/scorecard/cron/bq"
|
||||
"github.com/ossf/scorecard/cron/monitoring"
|
||||
@ -35,9 +39,6 @@ import (
|
||||
"github.com/ossf/scorecard/repos"
|
||||
"github.com/ossf/scorecard/roundtripper"
|
||||
"github.com/ossf/scorecard/stats"
|
||||
"github.com/shurcooL/githubv4"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type Repository struct {
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
|
||||
"github.com/ossf/scorecard/cron/config"
|
||||
)
|
||||
|
||||
|
@ -22,10 +22,13 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
"gocloud.dev/pubsub"
|
||||
_ "gocloud.dev/pubsub/gcppubsub" // Needed to link in GCP drivers.
|
||||
|
||||
// Needed to link in GCP drivers.
|
||||
_ "gocloud.dev/pubsub/gcppubsub"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
)
|
||||
|
||||
var errorPublish = errors.New("total errors when publishing")
|
||||
|
@ -19,8 +19,9 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
"gocloud.dev/pubsub"
|
||||
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
)
|
||||
|
||||
type mockSucceedTopic struct{}
|
||||
|
@ -19,10 +19,13 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
"gocloud.dev/pubsub"
|
||||
_ "gocloud.dev/pubsub/gcppubsub" // Needed to link in GCP drivers.
|
||||
|
||||
// Needed to link in GCP drivers.
|
||||
_ "gocloud.dev/pubsub/gcppubsub"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
)
|
||||
|
||||
var ErrorInParse = errors.New("error during protojson.Unmarshal")
|
||||
|
@ -19,10 +19,11 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
"gocloud.dev/pubsub"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
)
|
||||
|
||||
type mockReceiver struct {
|
||||
|
@ -24,6 +24,9 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
"github.com/shurcooL/githubv4"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/ossf/scorecard/checks"
|
||||
"github.com/ossf/scorecard/cron/config"
|
||||
"github.com/ossf/scorecard/cron/data"
|
||||
@ -31,8 +34,6 @@ import (
|
||||
"github.com/ossf/scorecard/pkg"
|
||||
"github.com/ossf/scorecard/repos"
|
||||
"github.com/ossf/scorecard/roundtripper"
|
||||
"github.com/shurcooL/githubv4"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func processRequest(ctx context.Context,
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/roundtripper"
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -24,9 +24,10 @@ import (
|
||||
"github.com/google/go-github/v32/github"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/ossf/scorecard/roundtripper"
|
||||
"github.com/shurcooL/githubv4"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/ossf/scorecard/roundtripper"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/checks"
|
||||
)
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/gitcache/pkg"
|
||||
)
|
||||
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/ossf/scorecard/gitcache/pkg"
|
||||
)
|
||||
|
||||
|
@ -21,8 +21,9 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/ossf/scorecard/gitcache/pkg"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/ossf/scorecard/gitcache/pkg"
|
||||
)
|
||||
|
||||
type cache struct {
|
||||
|
@ -21,9 +21,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-github/v32/github"
|
||||
"github.com/shurcooL/githubv4"
|
||||
|
||||
"github.com/ossf/scorecard/checker"
|
||||
"github.com/ossf/scorecard/repos"
|
||||
"github.com/shurcooL/githubv4"
|
||||
)
|
||||
|
||||
func runEnabledChecks(ctx context.Context,
|
||||
|
@ -18,10 +18,11 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/ossf/scorecard/stats"
|
||||
"go.opencensus.io/plugin/ochttp"
|
||||
opencensusstats "go.opencensus.io/stats"
|
||||
"go.opencensus.io/tag"
|
||||
|
||||
"github.com/ossf/scorecard/stats"
|
||||
)
|
||||
|
||||
func MakeCensusTransport(innerTransport http.RoundTripper) http.RoundTripper {
|
||||
|
@ -20,11 +20,12 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ossf/scorecard/stats"
|
||||
"github.com/pkg/errors"
|
||||
opencensusstats "go.opencensus.io/stats"
|
||||
"go.opencensus.io/tag"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/ossf/scorecard/stats"
|
||||
)
|
||||
|
||||
func MakeRateLimitedTransport(innerTransport http.RoundTripper, logger *zap.SugaredLogger) http.RoundTripper {
|
||||
|
Loading…
Reference in New Issue
Block a user