Preparing report...

Report for github.com/coreos/prometheus-operator

A+    Excellent!    Found 61 issues across 174 files

Tweet

gofmt94%

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!


gocyclo87%

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.

    • prometheus-operator/pkg/prometheus/operator.go
    • Line 1480: warning: cyclomatic complexity 27 of function (*Operator).createOrUpdateConfigurationSecret() is high (> 15) (gocyclo)
    • Line 1203: warning: cyclomatic complexity 26 of function (*Operator).sync() is high (> 15) (gocyclo)
    • Line 94: warning: cyclomatic complexity 19 of function New() is high (> 15) (gocyclo)
    • Line 1631: warning: cyclomatic complexity 19 of function (*Operator).selectServiceMonitors() is high (> 15) (gocyclo)
    • Line 1730: warning: cyclomatic complexity 17 of function (*Operator).selectPodMonitors() is high (> 15) (gocyclo)
    • Line 1821: warning: cyclomatic complexity 17 of function (*Operator).selectProbes() is high (> 15) (gocyclo)
    • prometheus-operator/pkg/prometheus/promcfg.go
    • Line 898: warning: cyclomatic complexity 44 of function (*ConfigGenerator).generateServiceMonitorConfig() is high (> 15) (gocyclo)
    • Line 434: warning: cyclomatic complexity 43 of function (*ConfigGenerator).generatePodMonitorConfig() is high (> 15) (gocyclo)
    • Line 1427: warning: cyclomatic complexity 34 of function (*ConfigGenerator).generateRemoteWriteConfig() is high (> 15) (gocyclo)
    • Line 159: warning: cyclomatic complexity 30 of function (*ConfigGenerator).GenerateConfig() is high (> 15) (gocyclo)
    • Line 675: warning: cyclomatic complexity 26 of function (*ConfigGenerator).generateProbeConfig() is high (> 15) (gocyclo)
    • prometheus-operator/test/e2e/prometheus_test.go
    • Line 63: warning: cyclomatic complexity 26 of function createK8sResources() is high (> 15) (gocyclo)
    • Line 2738: warning: cyclomatic complexity 23 of function testOperatorNSScope() is high (> 15) (gocyclo)
    • Line 1637: warning: cyclomatic complexity 22 of function testPromOnlyUpdatedOnRelevantChanges() is high (> 15) (gocyclo)

golint77%

Golint is a linter for Go source code.

    • prometheus-operator/pkg/api/api.go
    • Line 34: warning: exported type API should have comment or be unexported (golint)
    • Line 40: warning: exported function New should have comment or be unexported (golint)
    • Line 67: warning: exported method API.Register should have comment or be unexported (golint)
    • prometheus-operator/pkg/operator/defaults.go
    • Line 20: warning: exported const DefaultAlertmanagerVersion should have comment (or a comment on this block) or be unexported (golint)
    • Line 29: warning: exported var DefaultPrometheusConfigReloaderImage should have comment or be unexported (golint)
    • prometheus-operator/test/framework/helpers.go
    • Line 35: warning: exported function PathToOSFile should have comment or be unexported (golint)
    • Line 77: warning: exported function WaitForPodsRunImage should have comment or be unexported (golint)
    • Line 98: warning: exported function WaitForHTTPSuccessStatusCode should have comment or be unexported (golint)
    • Line 126: warning: exported function GetLogs should have comment or be unexported (golint)
    • Line 140: warning: exported function ProxyGetPod should have comment or be unexported (golint)
    • Line 152: warning: exported function ProxyPostPod should have comment or be unexported (golint)
    • prometheus-operator/test/framework/service.go
    • Line 30: warning: exported function MakeService should have comment or be unexported (golint)
    • Line 43: warning: exported function CreateServiceAndWaitUntilReady should have comment or be unexported (golint)
    • Line 56: warning: exported function WaitForServiceReady should have comment or be unexported (golint)
    • Line 70: warning: exported function DeleteServiceAndWaitUntilGone should have comment or be unexported (golint)
    • prometheus-operator/test/framework/alertmanager.go
    • Line 41: warning: exported var ValidAlertmanagerConfig should have comment or be unexported (golint)
    • Line 55: warning: exported method Framework.MakeBasicAlertmanager should have comment or be unexported (golint)
    • Line 67: warning: exported method Framework.MakeAlertmanagerService should have comment or be unexported (golint)
    • Line 93: warning: exported method Framework.SecretFromYaml should have comment or be unexported (golint)
    • Line 108: warning: exported method Framework.AlertmanagerConfigSecret should have comment or be unexported (golint)
    • Line 119: warning: exported method Framework.CreateAlertmanagerAndWaitUntilReady should have comment or be unexported (golint)
    • Line 170: warning: exported method Framework.UpdateAlertmanagerAndWaitUntilReady should have comment or be unexported (golint)
    • Line 190: warning: exported method Framework.DeleteAlertmanagerAndWaitUntilGone should have comment or be unexported (golint)
    • Line 213: warning: exported method Framework.WaitForAlertmanagerInitialized should have comment or be unexported (golint)
    • Line 258: warning: exported method Framework.GetAlertmanagerStatus should have comment or be unexported (golint)
    • Line 273: warning: exported method Framework.GetAlertmanagerMetrics should have comment or be unexported (golint)
    • Line 282: warning: exported method Framework.CreateSilence should have comment or be unexported (golint)
    • Line 326: warning: exported method Framework.GetSilences should have comment or be unexported (golint)
    • Line 372: warning: exported method Framework.WaitForAlertmanagerConfigToContainString should have comment or be unexported (golint)
    • Line 381: warning: exported method Framework.WaitForAlertmanagerConfigToBeReloaded should have comment or be unexported (golint)
    • prometheus-operator/test/framework/framework.go
    • Line 52: warning: exported type Framework should have comment or be unexported (golint)
    • Line 109: warning: exported method Framework.MakeEchoService should have comment or be unexported (golint)
    • Line 134: warning: exported method Framework.MakeEchoDeployment should have comment or be unexported (golint)
    • Line 401: warning: exported method TestCtx.SetupPrometheusRBAC should have comment or be unexported (golint)
    • Line 418: warning: exported method TestCtx.SetupPrometheusRBACGlobal should have comment or be unexported (golint)
    • prometheus-operator/test/framework/prometheus_rule.go
    • Line 29: warning: exported method Framework.MakeBasicRule should have comment or be unexported (golint)
    • Line 44: warning: exported method Framework.CreateRule should have comment or be unexported (golint)
    • Line 53: warning: exported method Framework.GetRule should have comment or be unexported (golint)
    • Line 62: warning: exported method Framework.MakeAndCreateFiringRule should have comment or be unexported (golint)
    • Line 84: warning: exported method Framework.MakeAndCreateInvalidRule should have comment or be unexported (golint)
    • Line 120: warning: exported method Framework.UpdateRule should have comment or be unexported (golint)
    • Line 129: warning: exported method Framework.DeleteRule should have comment or be unexported (golint)
    • prometheus-operator/pkg/k8sutil/k8sutil.go
    • Line 65: warning: exported function NewClusterConfig should have comment or be unexported (golint)
    • Line 101: warning: exported function IsResourceNotFoundError should have comment or be unexported (golint)
    • Line 112: warning: exported function CreateOrUpdateService should have comment or be unexported (golint)
    • Line 138: warning: exported function CreateOrUpdateEndpoints should have comment or be unexported (golint)
    • prometheus-operator/test/framework/ingress.go
    • Line 33: warning: exported function MakeBasicIngress should have comment or be unexported (golint)
    • Line 60: warning: exported function CreateIngress should have comment or be unexported (golint)
    • Line 65: warning: exported function SetupNginxIngressControllerIncDefaultBackend should have comment or be unexported (golint)
    • Line 99: warning: exported function DeleteNginxIngressControllerIncDefaultBackend should have comment or be unexported (golint)
    • Line 129: warning: exported function GetIngressIP should have comment or be unexported (golint)
    • prometheus-operator/test/framework/prometheus.go
    • Line 41: warning: exported const SECRET should have comment (or a comment on this block) or be unexported (golint)
    • Line 45: warning: exported type Key should have comment or be unexported (golint)
    • Line 50: warning: exported type Cert should have comment or be unexported (golint)
    • Line 56: warning: exported type PromRemoteWriteTestConfig should have comment or be unexported (golint)
    • Line 66: warning: exported method Framework.MakeBasicPrometheus should have comment or be unexported (golint)
    • Line 101: warning: exported method Framework.AddRemoteWriteWithTLSToPrometheus should have comment or be unexported (golint)
    • Line 166: warning: exported method Framework.AddAlertingToPrometheus should have comment or be unexported (golint)
    • Line 178: warning: exported method Framework.MakeBasicServiceMonitor should have comment or be unexported (golint)
    • Line 202: warning: exported method Framework.MakeBasicPodMonitor should have comment or be unexported (golint)
    • Line 226: warning: exported method Framework.MakePrometheusService should have comment or be unexported (golint)
    • Line 251: warning: exported method Framework.MakeThanosQuerierService should have comment or be unexported (golint)
    • Line 272: warning: exported method Framework.CreatePrometheusAndWaitUntilReady should have comment or be unexported (golint)
    • Line 285: warning: exported method Framework.UpdatePrometheusAndWaitUntilReady should have comment or be unexported (golint)
    • Line 297: warning: exported method Framework.WaitForPrometheusReady should have comment or be unexported (golint)
    • Line 321: warning: exported method Framework.DeletePrometheusAndWaitUntilGone should have comment or be unexported (golint)
    • Line 347: warning: exported method Framework.WaitForPrometheusRunImageAndReady should have comment or be unexported (golint)
    • Line 411: warning: exported method Framework.WaitForDiscoveryWorking should have comment or be unexported (golint)
    • Line 491: warning: exported method Framework.PrometheusSVCGetRequest should have comment or be unexported (golint)
    • Line 497: warning: exported method Framework.GetActiveTargets should have comment or be unexported (golint)
    • Line 511: warning: exported method Framework.GetHealthyTargets should have comment or be unexported (golint)
    • Line 530: warning: exported method Framework.CheckPrometheusFiringAlert should have comment or be unexported (golint)
    • Line 571: warning: exported method Framework.WaitForPrometheusFiringAlert should have comment or be unexported (golint)
    • Line 598: warning: exported type Target should have comment or be unexported (golint)
    • Line 614: warning: exported type PrometheusQueryResult should have comment or be unexported (golint)
    • Line 619: warning: exported type PrometheusQueryData should have comment or be unexported (golint)
    • Line 624: warning: exported type PrometheusQueryAPIResponse should have comment or be unexported (golint)
    • prometheus-operator/pkg/apis/monitoring/v1/types.go
    • Line 25: warning: exported const Version should have comment (or a comment on this block) or be unexported (golint)
    • Line 1356: warning: comment on exported type MetadataConfig should be of the form "MetadataConfig ..." (with optional leading article) (golint)
    • Line 1402: warning: comment on exported type Rules should be of the form "Rules ..." (with optional leading article) (golint)
    • Line 1408: warning: comment on exported type RulesAlert should be of the form "RulesAlert ..." (with optional leading article) (golint)
    • prometheus-operator/test/framework/namespace.go
    • Line 30: warning: exported function CreateNamespace should have comment or be unexported (golint)
    • Line 42: warning: exported method TestCtx.CreateNamespace should have comment or be unexported (golint)
    • Line 57: warning: exported function DeleteNamespace should have comment or be unexported (golint)
    • Line 61: warning: exported function AddLabelsToNamespace should have comment or be unexported (golint)
    • Line 83: warning: exported function RemoveLabelsFromNamespace should have comment or be unexported (golint)
    • prometheus-operator/test/framework/probe.go
    • Line 30: warning: exported method Framework.MakeBlackBoxExporterService should have comment or be unexported (golint)
    • Line 161: warning: exported method Framework.CreateBlackBoxExporterAndWaitUntilReady should have comment or be unexported (golint)
    • Line 169: warning: exported method Framework.MakeBasicStaticProbe should have comment or be unexported (golint)
    • prometheus-operator/test/framework/role-binding.go
    • Line 26: warning: exported function CreateRoleBinding should have comment or be unexported (golint)
    • Line 37: warning: exported function CreateRoleBindingForSubjectNamespace should have comment or be unexported (golint)
    • Line 53: warning: exported function DeleteRoleBinding should have comment or be unexported (golint)
    • prometheus-operator/pkg/admission/admission.go
    • Line 58: warning: exported function New should have comment or be unexported (golint)
    • Line 62: warning: exported method Admission.Register should have comment or be unexported (golint)
    • Line 67: warning: exported method Admission.RegisterMetrics should have comment or be unexported (golint)
    • prometheus-operator/test/framework/cluster_role.go
    • Line 27: warning: exported var CRDCreateRule should have comment or be unexported (golint)
    • Line 49: warning: exported function CreateClusterRole should have comment or be unexported (golint)
    • Line 75: warning: exported function DeleteClusterRole should have comment or be unexported (golint)
    • Line 84: warning: exported function UpdateClusterRole should have comment or be unexported (golint)
    • prometheus-operator/test/framework/context.go
    • Line 26: warning: exported type TestCtx should have comment or be unexported (golint)
    • Line 31: warning: exported type FinalizerFn should have comment or be unexported (golint)
    • Line 33: warning: exported method Framework.NewTestCtx should have comment or be unexported (golint)
    • Line 59: warning: exported method TestCtx.Cleanup should have comment or be unexported (golint)
    • Line 71: warning: exported method TestCtx.AddFinalizerFn should have comment or be unexported (golint)
    • prometheus-operator/test/framework/config_map.go
    • Line 30: warning: exported function MakeConfigMapWithCert should have comment or be unexported (golint)
    • Line 53: warning: exported method Framework.WaitForConfigMapExist should have comment or be unexported (golint)
    • Line 75: warning: exported method Framework.WaitForConfigMapNotExist should have comment or be unexported (golint)
    • prometheus-operator/test/framework/deployment.go
    • Line 31: warning: exported function GetDeployment should have comment or be unexported (golint)
    • Line 35: warning: exported function UpdateDeployment should have comment or be unexported (golint)
    • Line 39: warning: exported function MakeDeployment should have comment or be unexported (golint)
    • Line 52: warning: exported function CreateDeployment should have comment or be unexported (golint)
    • Line 61: warning: exported function DeleteDeployment should have comment or be unexported (golint)
    • Line 77: warning: exported function WaitUntilDeploymentGone should have comment or be unexported (golint)
    • prometheus-operator/test/framework/thanosruler.go
    • Line 34: warning: exported method Framework.MakeBasicThanosRuler should have comment or be unexported (golint)
    • Line 47: warning: exported method Framework.CreateThanosRulerAndWaitUntilReady should have comment or be unexported (golint)
    • Line 60: warning: exported method Framework.UpdateThanosRulerAndWaitUntilReady should have comment or be unexported (golint)
    • Line 72: warning: exported method Framework.WaitForThanosRulerReady should have comment or be unexported (golint)
    • Line 91: warning: exported method Framework.MakeThanosRulerService should have comment or be unexported (golint)
    • Line 116: warning: exported method Framework.WaitForThanosFiringAlert should have comment or be unexported (golint)
    • Line 136: warning: exported method Framework.CheckThanosFiringAlert should have comment or be unexported (golint)
    • Line 164: warning: exported method Framework.ThanosSVCGetRequest should have comment or be unexported (golint)
    • Line 170: warning: exported method Framework.DeleteThanosRulerAndWaitUntilGone should have comment or be unexported (golint)
    • Line 196: warning: exported type ThanosAlert should have comment or be unexported (golint)
    • Line 204: warning: exported type ThanosAlertsData should have comment or be unexported (golint)
    • Line 208: warning: exported type ThanosAlertsAPIResponse should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign100%

IneffAssign detects ineffectual assignments in Go code.

No problems detected. Good job!


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!