Preparing report...

Report for github.com/blackducksoftware/ose-scanner

A    Great!    Found 26 issues across 28 files

Tweet

gofmt96%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


gocyclo89%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

    • ose-scanner/common/scanresults.go
    • Line 33: warning: cyclomatic complexity 22 of function ScanResults() is high (> 15) (gocyclo)
    • Line 229: warning: cyclomatic complexity 19 of function GetScanResultsFromProjectVersion() is high (> 15) (gocyclo)

golint14%

Golint is a linter for Go source code.

    • ose-scanner/controller/pkg/controller/controller.go
    • Line 40: warning: exported type HubParams should have comment or be unexported (golint)
    • Line 47: warning: exported type PodInfo should have comment or be unexported (golint)
    • Line 52: warning: exported type Controller should have comment or be unexported (golint)
    • Line 64: warning: exported function NewController should have comment or be unexported (golint)
    • Line 79: warning: exported method Controller.Start should have comment or be unexported (golint)
    • Line 89: warning: exported method Controller.Watch should have comment or be unexported (golint)
    • Line 99: warning: exported method Controller.Stop should have comment or be unexported (golint)
    • Line 110: warning: exported method Controller.Load should have comment or be unexported (golint)
    • Line 127: warning: exported method Controller.AddImage should have comment or be unexported (golint)
    • Line 218: warning: exported method Controller.RemoveImage should have comment or be unexported (golint)
    • Line 365: warning: exported method Controller.ValidateConfig should have comment or be unexported (golint)
    • Line 371: warning: exported method Controller.ValidateDockerConfig should have comment or be unexported (golint)
    • ose-scanner/controller/pkg/controller/worker.go
    • Line 30: warning: exported type Worker should have comment or be unexported (golint)
    • Line 38: warning: exported function NewWorker should have comment or be unexported (golint)
    • Line 48: warning: exported method Worker.Start should have comment or be unexported (golint)
    • Line 70: warning: exported method Worker.RequestScanAuthorization should have comment or be unexported (golint)
    • ose-scanner/common/scanresults.go
    • Line 33: warning: error should be the last type when returning multiple items (golint)
    • Line 33: warning: exported function ScanResults should have comment or be unexported (golint)
    • Line 155: warning: exported function ValidateGetProjectVersion should have comment or be unexported (golint)
    • Line 173: warning: error should be the last type when returning multiple items (golint)
    • Line 173: warning: exported function ProjectVersionResults should have comment or be unexported (golint)
    • Line 229: warning: error should be the last type when returning multiple items (golint)
    • Line 331: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • ose-scanner/controller/pkg/controller/job.go
    • Line 40: warning: exported type Job should have comment or be unexported (golint)
    • Line 45: warning: exported type Spec should have comment or be unexported (golint)
    • Line 49: warning: exported method Job.Done should have comment or be unexported (golint)
    • Line 54: warning: exported method Job.Load should have comment or be unexported (golint)
    • Line 79: warning: exported method Job.UpdateImageAnnotationInfo should have comment or be unexported (golint)
    • Line 160: warning: exported method Job.ApplyAnnotationInfoToPods should have comment or be unexported (golint)
    • ose-scanner/arbiter/pkg/arbiter/arbiter.go
    • Line 40: warning: exported type HubParams should have comment or be unexported (golint)
    • Line 45: warning: exported var Hub should have comment or be unexported (golint)
    • Line 47: warning: exported type PodInfo should have comment or be unexported (golint)
    • Line 52: warning: exported type Arbiter should have comment or be unexported (golint)
    • Line 67: warning: exported function NewArbiter should have comment or be unexported (golint)
    • Line 86: warning: exported method Arbiter.Start should have comment or be unexported (golint)
    • Line 104: warning: exported method Arbiter.Watch should have comment or be unexported (golint)
    • Line 114: warning: exported method Arbiter.Stop should have comment or be unexported (golint)
    • Line 125: warning: exported method Arbiter.Load should have comment or be unexported (golint)
    • Line 165: warning: exported method Arbiter.DoneScan should have comment or be unexported (golint)
    • Line 174: warning: exported method Arbiter.DonePod should have comment or be unexported (golint)
    • Line 186: warning: exported method Arbiter.Add should have comment or be unexported (golint)
    • Line 204: warning: exported method Arbiter.RemoveImage should have comment or be unexported (golint)
    • ose-scanner/arbiter/pkg/arbiter/worker.go
    • Line 30: warning: exported type Worker should have comment or be unexported (golint)
    • Line 37: warning: exported function NewWorker should have comment or be unexported (golint)
    • Line 46: warning: exported method Worker.Start should have comment or be unexported (golint)
    • Line 75: warning: exported method Worker.ProcessScanImage should have comment or be unexported (golint)
    • Line 100: warning: exported method Worker.ProcessPodImage should have comment or be unexported (golint)
    • ose-scanner/controller/cmd/controller/cmd.go
    • Line 53: warning: don't use underscores in Go names; var bds_version should be bdsVersion (golint)
    • Line 54: warning: don't use underscores in Go names; var build_num should be buildNum (golint)
    • Line 117: warning: exported function NewKubeClientFromCluster should have comment or be unexported (golint)
    • Line 122: warning: exported function NewKubeClientFromOutsideCluster should have comment or be unexported (golint)
    • ose-scanner/scanner/ose_scanner.go
    • Line 42: warning: exported const APP_VERSION should have comment (or a comment on this block) or be unexported (golint)
    • Line 83: warning: don't use underscores in Go names; var img_arr should be imgArr (golint)
    • Line 84: warning: don't use underscores in Go names; var img_name should be imgName (golint)
    • Line 85: warning: don't use underscores in Go names; var img_ps should be imgPs (golint)
    • Line 174: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • Line 403: warning: don't use underscores in Go names; var img_dir_name should be imgDirName (golint)
    • ose-scanner/controller/pkg/controller/dispatcher.go
    • Line 25: warning: exported const MaxWorkers should have comment or be unexported (golint)
    • Line 27: warning: exported type Dispatcher should have comment or be unexported (golint)
    • Line 34: warning: exported function NewDispatcher should have comment or be unexported (golint)
    • Line 43: warning: exported method Dispatcher.Run should have comment or be unexported (golint)
    • ose-scanner/arbiter/cmd/arbiter/cmd.go
    • Line 52: warning: don't use underscores in Go names; var bds_version should be bdsVersion (golint)
    • Line 53: warning: don't use underscores in Go names; var build_num should be buildNum (golint)
    • Line 108: warning: exported function NewKubeClientFromCluster should have comment or be unexported (golint)
    • Line 113: warning: exported function NewKubeClientFromOutsideCluster should have comment or be unexported (golint)
    • ose-scanner/arbiter/pkg/arbiter/dispatcher.go
    • Line 25: warning: exported const MaxWorkers should have comment or be unexported (golint)
    • Line 27: warning: exported type Dispatcher should have comment or be unexported (golint)
    • Line 33: warning: exported function NewDispatcher should have comment or be unexported (golint)
    • Line 41: warning: exported method Dispatcher.Run should have comment or be unexported (golint)
    • ose-scanner/arbiter/pkg/arbiter/watcher.go
    • Line 41: warning: exported type Watcher should have comment or be unexported (golint)
    • Line 47: warning: comment on exported function NewWatcher should be of the form "NewWatcher ..." (golint)
    • Line 60: warning: exported method Watcher.Run should have comment or be unexported (golint)
    • Line 114: warning: exported method Watcher.ImageAdded should have comment or be unexported (golint)
    • Line 140: warning: exported method Watcher.ImageUpdated should have comment or be unexported (golint)
    • Line 169: warning: exported method Watcher.ImageDeleted should have comment or be unexported (golint)
    • Line 191: warning: exported method Watcher.PodCreated should have comment or be unexported (golint)
    • ose-scanner/common/annotate.go
    • Line 33: warning: exported const ScannerVersionLabel should have comment or be unexported (golint)
    • Line 34: warning: exported const ScannerHubServerLabel should have comment or be unexported (golint)
    • Line 35: warning: exported const ScannerScanId should have comment or be unexported (golint)
    • Line 36: warning: exported const ScannerProjectVersionUrl should have comment or be unexported (golint)
    • Line 38: warning: exported type Annotator should have comment or be unexported (golint)
    • Line 43: warning: exported type ImageInfo should have comment or be unexported (golint)
    • Line 123: warning: exported type BlackduckAnnotation should have comment or be unexported (golint)
    • Line 145: warning: comment on exported method Annotator.CreateBlackduckVulnerabilityAnnotation should be of the form "CreateBlackduckVulnerabilityAnnotation ..." (golint)
    • Line 162: warning: exported method Annotator.CreateBlackduckPolicyAnnotation should have comment or be unexported (golint)
    • Line 179: warning: comment on exported method Annotator.IsScanNeeded should be of the form "IsScanNeeded ..." (golint)
    • ose-scanner/common/types.go
    • Line 36: warning: exported type HubConfig should have comment or be unexported (golint)
    • Line 47: warning: exported type CodeLocationStruct should have comment or be unexported (golint)
    • Line 64: warning: exported type CodeLocationsStruct should have comment or be unexported (golint)
    • Line 89: warning: exported type ScanSummaryStruct should have comment or be unexported (golint)
    • ose-scanner/controller/pkg/controller/docker.go
    • Line 34: warning: exported type ScanResult should have comment or be unexported (golint)
    • Line 39: warning: exported type Docker should have comment or be unexported (golint)
    • Line 168: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 261: warning: exported function NewDocker should have comment or be unexported (golint)
    • ose-scanner/controller/pkg/controller/watcher.go
    • Line 41: warning: exported type Watcher should have comment or be unexported (golint)
    • Line 47: warning: comment on exported function NewWatcher should be of the form "NewWatcher ..." (golint)
    • Line 60: warning: exported method Watcher.Run should have comment or be unexported (golint)
    • Line 112: warning: exported method Watcher.ImageAdded should have comment or be unexported (golint)
    • Line 140: warning: comment on exported method Watcher.ImageUpdated should be of the form "ImageUpdated ..." (golint)
    • Line 173: warning: exported method Watcher.ImageDeleted should have comment or be unexported (golint)
    • Line 195: warning: exported method Watcher.PodCreated should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign57%

IneffAssign detects ineffectual assignments in Go code.

    • ose-scanner/controller/cmd/controller/cmd.go
    • Line 43: warning: cannot find package "." in: (ineffassign)
    • Line 50: warning: cannot find package "." in: (ineffassign)
    • Line 45: warning: cannot find package "." in: (ineffassign)
    • Line 46: warning: cannot find package "." in: (ineffassign)
    • Line 47: warning: cannot find package "." in: (ineffassign)
    • Line 48: warning: cannot find package "." in: (ineffassign)
    • Line 41: warning: cannot find package "." in: (ineffassign)
    • Line 39: warning: cannot find package "." in: (ineffassign)
    • Line 39: warning: could not import ose-scanner/controller/pkg/controller (invalid package name: "") (ineffassign)
    • Line 41: warning: could not import ose-scanner/common (invalid package name: "") (ineffassign)
    • Line 43: warning: could not import github.com/openshift/client-go/image/clientset/versioned/typed/image/v1 (invalid package name: "") (ineffassign)
    • Line 45: warning: could not import k8s.io/client-go/kubernetes (invalid package name: "") (ineffassign)
    • Line 46: warning: could not import k8s.io/client-go/rest (invalid package name: "") (ineffassign)
    • Line 47: warning: could not import k8s.io/client-go/tools/clientcmd (invalid package name: "") (ineffassign)
    • Line 48: warning: could not import k8s.io/client-go/util/homedir (invalid package name: "") (ineffassign)
    • Line 50: warning: could not import github.com/spf13/pflag (invalid package name: "") (ineffassign)
    • ose-scanner/arbiter/cmd/arbiter/cmd.go
    • Line 42: warning: cannot find package "." in: (ineffassign)
    • Line 49: warning: cannot find package "." in: (ineffassign)
    • Line 44: warning: cannot find package "." in: (ineffassign)
    • Line 45: warning: cannot find package "." in: (ineffassign)
    • Line 46: warning: cannot find package "." in: (ineffassign)
    • Line 47: warning: cannot find package "." in: (ineffassign)
    • Line 40: warning: cannot find package "." in: (ineffassign)
    • Line 38: warning: cannot find package "." in: (ineffassign)
    • Line 38: warning: could not import ose-scanner/common (invalid package name: "") (ineffassign)
    • Line 40: warning: could not import ose-scanner/arbiter/pkg/arbiter (invalid package name: "") (ineffassign)
    • Line 42: warning: could not import github.com/openshift/client-go/image/clientset/versioned/typed/image/v1 (invalid package name: "") (ineffassign)
    • Line 44: warning: could not import k8s.io/client-go/kubernetes (invalid package name: "") (ineffassign)
    • Line 45: warning: could not import k8s.io/client-go/rest (invalid package name: "") (ineffassign)
    • Line 46: warning: could not import k8s.io/client-go/tools/clientcmd (invalid package name: "") (ineffassign)
    • Line 47: warning: could not import k8s.io/client-go/util/homedir (invalid package name: "") (ineffassign)
    • Line 49: warning: could not import github.com/spf13/pflag (invalid package name: "") (ineffassign)
    • ose-scanner/controller/pkg/controller/docker.go
    • Line 27: warning: cannot find package "." in: (ineffassign)
    • Line 27: warning: could not import github.com/fsouza/go-dockerclient (invalid package name: "") (ineffassign)
    • Line 40: warning: undeclared name: docker (ineffassign)
    • Line 96: warning: undeclared name: docker (ineffassign)
    • Line 101: warning: undeclared name: docker (ineffassign)
    • Line 129: warning: undeclared name: docker (ineffassign)
    • Line 130: warning: undeclared name: docker (ineffassign)
    • Line 137: warning: undeclared name: docker (ineffassign)
    • Line 154: warning: undeclared name: docker (ineffassign)
    • Line 172: warning: undeclared name: docker (ineffassign)
    • Line 194: warning: undeclared name: docker (ineffassign)
    • Line 264: warning: undeclared name: docker (ineffassign)
    • Line 27: warning: "github.com/fsouza/go-dockerclient" imported but not used (ineffassign)
    • ose-scanner/controller/pkg/controller/job.go
    • Line 30: warning: cannot find package "." in: (ineffassign)
    • Line 34: warning: cannot find package "." in: (ineffassign)
    • Line 30: warning: could not import github.com/openshift/api/image/v1 (invalid package name: "") (ineffassign)
    • Line 34: warning: could not import k8s.io/apimachinery/pkg/types (invalid package name: "") (ineffassign)
    • ose-scanner/controller/pkg/controller/controller.go
    • Line 33: warning: cannot find package "." in: (ineffassign)
    • Line 35: warning: cannot find package "." in: (ineffassign)
    • Line 36: warning: cannot find package "." in: (ineffassign)
    • Line 37: warning: cannot find package "." in: (ineffassign)
    • Line 31: warning: cannot find package "." in: (ineffassign)
    • Line 31: warning: could not import ose-scanner/common (invalid package name: "") (ineffassign)
    • Line 33: warning: could not import github.com/openshift/client-go/image/clientset/versioned/typed/image/v1 (invalid package name: "") (ineffassign)
    • Line 35: warning: could not import k8s.io/api/core/v1 (invalid package name: "") (ineffassign)
    • Line 36: warning: could not import k8s.io/apimachinery/pkg/apis/meta/v1 (invalid package name: "") (ineffassign)
    • Line 37: warning: could not import k8s.io/client-go/kubernetes (invalid package name: "") (ineffassign)
    • ose-scanner/arbiter/pkg/arbiter/watcher.go
    • Line 30: warning: cannot find package "." in: (ineffassign)
    • Line 34: warning: cannot find package "." in: (ineffassign)
    • Line 35: warning: cannot find package "." in: (ineffassign)
    • Line 36: warning: cannot find package "." in: (ineffassign)
    • Line 37: warning: cannot find package "." in: (ineffassign)
    • Line 38: warning: cannot find package "." in: (ineffassign)
    • Line 30: warning: could not import github.com/openshift/api/image/v1 (invalid package name: "") (ineffassign)
    • Line 34: warning: could not import k8s.io/apimachinery/pkg/fields (invalid package name: "") (ineffassign)
    • Line 35: warning: could not import k8s.io/apimachinery/pkg/runtime (invalid package name: "") (ineffassign)
    • Line 36: warning: could not import k8s.io/apimachinery/pkg/util/wait (invalid package name: "") (ineffassign)
    • Line 37: warning: could not import k8s.io/apimachinery/pkg/watch (invalid package name: "") (ineffassign)
    • Line 38: warning: could not import k8s.io/client-go/tools/cache (invalid package name: "") (ineffassign)
    • ose-scanner/arbiter/pkg/arbiter/arbiter.go
    • Line 33: warning: cannot find package "." in: (ineffassign)
    • Line 35: warning: cannot find package "." in: (ineffassign)
    • Line 36: warning: cannot find package "." in: (ineffassign)
    • Line 37: warning: cannot find package "." in: (ineffassign)
    • Line 31: warning: cannot find package "." in: (ineffassign)
    • Line 31: warning: could not import ose-scanner/common (invalid package name: "") (ineffassign)
    • Line 33: warning: could not import github.com/openshift/client-go/image/clientset/versioned/typed/image/v1 (invalid package name: "") (ineffassign)
    • Line 35: warning: could not import k8s.io/api/core/v1 (invalid package name: "") (ineffassign)
    • Line 36: warning: could not import k8s.io/apimachinery/pkg/apis/meta/v1 (invalid package name: "") (ineffassign)
    • Line 37: warning: could not import k8s.io/client-go/kubernetes (invalid package name: "") (ineffassign)
    • ose-scanner/common/annotate_test.go
    • Line 62: warning: cannot use "ref" (untyped string constant) as int value in argument to mockAnnotator.UpdateAnnotations (ineffassign)
    • Line 62: warning: cannot use 4 (untyped int constant) as string value in argument to mockAnnotator.UpdateAnnotations (ineffassign)
    • ose-scanner/controller/pkg/controller/watcher.go
    • Line 34: warning: cannot find package "." in: (ineffassign)
    • Line 35: warning: cannot find package "." in: (ineffassign)
    • Line 36: warning: cannot find package "." in: (ineffassign)
    • Line 37: warning: cannot find package "." in: (ineffassign)
    • Line 38: warning: cannot find package "." in: (ineffassign)
    • Line 34: warning: could not import k8s.io/apimachinery/pkg/fields (invalid package name: "") (ineffassign)
    • Line 35: warning: could not import k8s.io/apimachinery/pkg/runtime (invalid package name: "") (ineffassign)
    • Line 36: warning: could not import k8s.io/apimachinery/pkg/util/wait (invalid package name: "") (ineffassign)
    • Line 37: warning: could not import k8s.io/apimachinery/pkg/watch (invalid package name: "") (ineffassign)
    • Line 38: warning: could not import k8s.io/client-go/tools/cache (invalid package name: "") (ineffassign)

misspell96%

Misspell Finds commonly misspelled English words