Preparing report...

Report for github.com/Graylog2/collector-sidecar

(v0.0.0-20211123211019-be8ee5135f9d)

A    Great!    Found 31 issues across 40 files

Tweet

gofmt90%

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!


gocyclo95%

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.

    • api/graylog.go
    • Line 139: warning: cyclomatic complexity 18 of function UpdateRegistration() is high (> 15) (gocyclo)

golint22%

Golint is a linter for Go source code.

    • api/graylog/responses.go
    • Line 20: warning: exported type ResponseCollectorRegistration should have comment or be unexported (golint)
    • Line 29: warning: exported type ResponseCollectorAction should have comment or be unexported (golint)
    • Line 34: warning: exported type ResponseCollectorRegistrationConfiguration should have comment or be unexported (golint)
    • Line 39: warning: exported type ResponseBackendList should have comment or be unexported (golint)
    • Line 45: warning: exported type ResponseCollectorBackend should have comment or be unexported (golint)
    • Line 56: warning: exported type ResponseCollectorConfiguration should have comment or be unexported (golint)
    • system/status.go
    • Line 19: warning: exported var GlobalStatus should have comment or be unexported (golint)
    • Line 22: warning: exported type Status should have comment or be unexported (golint)
    • Line 27: warning: exported method Status.Set should have comment or be unexported (golint)
    • Line 32: warning: exported type VerboseStatus should have comment or be unexported (golint)
    • Line 38: warning: exported method VerboseStatus.Set should have comment or be unexported (golint)
    • cfgfile/schema.go
    • Line 18: warning: exported type SidecarConfig should have comment or be unexported (golint)
    • Line 37: warning: comment on exported const CommonDefaults should be of the form "CommonDefaults ..." (golint)
    • Line 68: warning: comment on exported const WindowsDefaults should be of the form "WindowsDefaults ..." (golint)
    • daemon/distributor.go
    • Line 24: warning: exported type Distributor should have comment or be unexported (golint)
    • Line 29: warning: exported method DaemonConfig.NewDistributor should have comment or be unexported (golint)
    • Line 37: warning: exported method Distributor.BindToService should have comment or be unexported (golint)
    • Line 41: warning: comment on exported method Distributor.Start should be of the form "Start ..." (golint)
    • Line 52: warning: comment on exported method Distributor.Stop should be of the form "Stop ..." (golint)
    • common/fs.go
    • Line 28: warning: exported function FileExists should have comment or be unexported (golint)
    • Line 37: warning: exported function IsDir should have comment or be unexported (golint)
    • Line 50: warning: exported function CreatePathToFile should have comment or be unexported (golint)
    • Line 64: warning: exported function ListFiles should have comment or be unexported (golint)
    • Line 75: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • assignments/assignment.go
    • Line 24: warning: comment on exported var Store should be of the form "Store ..." (golint)
    • Line 32: warning: exported type ConfigurationAssignment should have comment or be unexported (golint)
    • backends/backend.go
    • Line 35: warning: exported type Backend should have comment or be unexported (golint)
    • Line 49: warning: exported function BackendFromResponse should have comment or be unexported (golint)
    • Line 64: warning: exported function BuildConfigurationPath should have comment or be unexported (golint)
    • Line 67: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 72: warning: exported method Backend.Equals should have comment or be unexported (golint)
    • Line 76: warning: exported method Backend.EqualSettings should have comment or be unexported (golint)
    • Line 101: warning: exported method Backend.CheckExecutableAgainstAccesslist should have comment or be unexported (golint)
    • Line 113: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 121: warning: exported method Backend.CheckConfigPathAgainstAccesslist should have comment or be unexported (golint)
    • Line 134: warning: error should be the last type when returning multiple items (golint)
    • Line 134: warning: exported method Backend.ValidateConfigurationFile should have comment or be unexported (golint)
    • daemon/exec_runner.go
    • Line 37: warning: exported type ExecRunner should have comment or be unexported (golint)
    • Line 56: warning: exported function NewExecRunner should have comment or be unexported (golint)
    • Line 81: warning: exported method ExecRunner.Name should have comment or be unexported (golint)
    • Line 85: warning: exported method ExecRunner.Running should have comment or be unexported (golint)
    • Line 93: warning: exported method ExecRunner.Supervised should have comment or be unexported (golint)
    • Line 101: warning: exported method ExecRunner.SetDaemon should have comment or be unexported (golint)
    • Line 105: warning: exported method ExecRunner.GetBackend should have comment or be unexported (golint)
    • Line 109: warning: exported method ExecRunner.SetBackend should have comment or be unexported (golint)
    • Line 119: warning: exported method ExecRunner.ResetRestartCounter should have comment or be unexported (golint)
    • Line 123: warning: exported method ExecRunner.ValidateBeforeStart should have comment or be unexported (golint)
    • Line 220: warning: exported method ExecRunner.Shutdown should have comment or be unexported (golint)
    • Line 256: warning: exported method ExecRunner.Restart should have comment or be unexported (golint)
    • common/exec_helper.go
    • Line 20: warning: comment on exported function CommandLineToArgv should be of the form "CommandLineToArgv ..." (golint)
    • daemon/daemon.go
    • Line 27: warning: exported var Daemon should have comment or be unexported (golint)
    • Line 32: warning: exported type DaemonConfig should have comment or be unexported (golint)
    • Line 47: warning: exported function NewConfig should have comment or be unexported (golint)
    • Line 65: warning: exported function RegisterBackendRunner should have comment or be unexported (golint)
    • Line 74: warning: exported method DaemonConfig.AddRunner should have comment or be unexported (golint)
    • Line 92: warning: exported method DaemonConfig.DeleteRunner should have comment or be unexported (golint)
    • Line 105: warning: exported method DaemonConfig.GetRunnerByBackendId should have comment or be unexported (golint)
    • Line 114: warning: exported method DaemonConfig.SyncWithAssignments should have comment or be unexported (golint)
    • daemon/svc_helper.go
    • Line 24: warning: comment on exported function CleanOldServices should be of the form "CleanOldServices ..." (golint)
    • context/context.go
    • Line 33: warning: exported type Ctx should have comment or be unexported (golint)
    • Line 41: warning: exported function NewContext should have comment or be unexported (golint)
    • Line 47: warning: exported method Ctx.LoadConfig should have comment or be unexported (golint)
    • logger/logger.go
    • Line 27: warning: exported function Log should have comment or be unexported (golint)
    • Line 31: warning: exported function GetRotatedLog should have comment or be unexported (golint)
    • daemon/runner.go
    • Line 23: warning: exported type Runner should have comment or be unexported (golint)
    • Line 34: warning: exported type RunnerCommon should have comment or be unexported (golint)
    • Line 41: warning: exported type RunnerCreator should have comment or be unexported (golint)
    • api/rest/rest.go
    • Line 47: warning: exported type Client should have comment or be unexported (golint)
    • Line 58: warning: exported type Response should have comment or be unexported (golint)
    • Line 62: warning: exported type ErrorResponse should have comment or be unexported (golint)
    • Line 74: warning: exported function NewHTTPClient should have comment or be unexported (golint)
    • Line 90: warning: exported function NewClient should have comment or be unexported (golint)
    • Line 101: warning: exported method Client.NewRequest should have comment or be unexported (golint)
    • Line 146: warning: exported function CheckResponse should have comment or be unexported (golint)
    • Line 163: warning: exported method Client.Do should have comment or be unexported (golint)
    • common/helper.go
    • Line 34: warning: exported function GetRootPath should have comment or be unexported (golint)
    • Line 38: warning: exported function GetSystemName should have comment or be unexported (golint)
    • Line 45: warning: exported function GetHostname should have comment or be unexported (golint)
    • Line 49: warning: exported function GetHostIP should have comment or be unexported (golint)
    • Line 79: warning: exported function GetCollectorId should have comment or be unexported (golint)
    • Line 102: warning: exported function RandomUuid should have comment or be unexported (golint)
    • Line 106: warning: exported function ConvertLineBreak should have comment or be unexported (golint)
    • Line 109: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 115: warning: exported function EnsureLineBreak should have comment or be unexported (golint)
    • Line 121: warning: exported function EncloseWith should have comment or be unexported (golint)
    • Line 136: warning: exported function Inspect should have comment or be unexported (golint)
    • Line 141: warning: exported function NewTrue should have comment or be unexported (golint)
    • Line 146: warning: exported function NewFalse should have comment or be unexported (golint)
    • Line 151: warning: exported function IsInList should have comment or be unexported (golint)
    • Line 160: warning: exported function Sprintf should have comment or be unexported (golint)
    • Line 167: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 172: warning: exported type PathMatchResult should have comment or be unexported (golint)
    • Line 179: warning: exported function PathMatch should have comment or be unexported (golint)
    • Line 189: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • common/sigar.go
    • Line 33: warning: exported type CPU should have comment or be unexported (golint)
    • Line 37: warning: exported type CpuTimes should have comment or be unexported (golint)
    • Line 49: warning: exported function GetCpuTimes should have comment or be unexported (golint)
    • Line 60: warning: exported function GetCpuPercentage should have comment or be unexported (golint)
    • Line 62: warning: don't use underscores in Go names; var all_delta should be allDelta (golint)
    • Line 89: warning: exported method CPU.AddCpuPercentage should have comment or be unexported (golint)
    • Line 93: warning: exported function GetCpuIdle should have comment or be unexported (golint)
    • Line 103: warning: exported function GetFileSystemList75 should have comment or be unexported (golint)
    • Line 129: warning: exported function GetLoad1 should have comment or be unexported (golint)
    • system/inventory.go
    • Line 23: warning: exported type Inventory should have comment or be unexported (golint)
    • Line 26: warning: exported function NewInventory should have comment or be unexported (golint)
    • Line 30: warning: exported method Inventory.Version should have comment or be unexported (golint)
    • Line 34: warning: exported method Inventory.Linux should have comment or be unexported (golint)
    • Line 38: warning: exported method Inventory.Darwin should have comment or be unexported (golint)
    • Line 42: warning: exported method Inventory.Windows should have comment or be unexported (golint)
    • Line 46: warning: exported method Inventory.LinuxPlatform should have comment or be unexported (golint)
    • Line 49: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • backends/status.go
    • Line 24: warning: exported const StatusRunning should have comment (or a comment on this block) or be unexported (golint)
    • Line 30: warning: exported method Backend.SetStatus should have comment or be unexported (golint)
    • Line 34: warning: exported method Backend.SetVerboseStatus should have comment or be unexported (golint)
    • Line 38: warning: exported method Backend.SetStatusLogErrorf should have comment or be unexported (golint)
    • Line 44: warning: exported method Backend.Status should have comment or be unexported (golint)
    • api/graylog.go
    • Line 43: warning: exported function RequestBackendList should have comment or be unexported (golint)
    • Line 87: warning: exported function RequestConfiguration should have comment or be unexported (golint)
    • Line 139: warning: exported function UpdateRegistration should have comment or be unexported (golint)
    • Line 236: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 247: warning: exported function GetTlsConfig should have comment or be unexported (golint)
    • Line 255: warning: exported function NewStatusRequest should have comment or be unexported (golint)
    • api/graylog/requests.go
    • Line 22: warning: exported type RegistrationRequest should have comment or be unexported (golint)
    • Line 27: warning: exported type NodeDetailsRequest should have comment or be unexported (golint)
    • Line 35: warning: exported type StatusRequestBackend should have comment or be unexported (golint)
    • Line 42: warning: exported type StatusRequest should have comment or be unexported (golint)
    • Line 48: warning: exported type MetricsRequest should have comment or be unexported (golint)
    • cfgfile/cfgfile.go
    • Line 43: warning: exported function ConfigDefaults should have comment or be unexported (golint)
    • Line 93: warning: comment on exported function SetConfigPath should be of the form "SetConfigPath ..." (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign92%

IneffAssign detects ineffectual assignments in Go code.

    • api/graylog.go
    • Line 257: warning: ineffectual assignment to combinedStatus (ineffassign)
    • Line 282: warning: ineffectual assignment to combinedStatus (ineffassign)

misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!