Preparing report...

Report for github.com/baetyl/baetyl-go

A+    Excellent!    Found 40 issues across 94 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!


gocyclo98%

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.


golint65%

Golint is a linter for Go source code.

    • baetyl-go/dmcontext/context.go
    • Line 22: warning: exported const DefaultAccessConf should have comment (or a comment on this block) or be unexported (golint)
    • Line 33: warning: exported var ErrInvalidMessage should have comment or be unexported (golint)
    • Line 43: warning: exported const TypeInt16 should have comment (or a comment on this block) or be unexported (golint)
    • Line 52: warning: exported type DeltaCallback should have comment or be unexported (golint)
    • Line 53: warning: exported type EventCallback should have comment or be unexported (golint)
    • Line 55: warning: exported type Context should have comment or be unexported (golint)
    • Line 73: warning: exported type DmCtx should have comment or be unexported (golint)
    • Line 88: warning: exported function NewContext should have comment or be unexported (golint)
    • Line 140: warning: exported method DmCtx.Start should have comment or be unexported (golint)
    • Line 147: warning: exported method DmCtx.Close should have comment or be unexported (golint)
    • Line 266: warning: exported method DmCtx.GetAllDevices should have comment or be unexported (golint)
    • Line 274: warning: exported method DmCtx.ReportDeviceProperties should have comment or be unexported (golint)
    • Line 291: warning: exported method DmCtx.GetDeviceProperties should have comment or be unexported (golint)
    • Line 322: warning: exported method DmCtx.RegisterDeltaCallback should have comment or be unexported (golint)
    • Line 331: warning: exported method DmCtx.RegisterEventCallback should have comment or be unexported (golint)
    • Line 340: warning: exported method DmCtx.Online should have comment or be unexported (golint)
    • Line 358: warning: exported method DmCtx.Offline should have comment or be unexported (golint)
    • Line 376: warning: exported method DmCtx.GetDriverConfig should have comment or be unexported (golint)
    • Line 379: warning: exported method DmCtx.GetAccessConfig should have comment or be unexported (golint)
    • Line 383: warning: exported method DmCtx.GetDeviceAccessConfig should have comment or be unexported (golint)
    • Line 386: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 391: warning: exported method DmCtx.GetPropertiesConfig should have comment or be unexported (golint)
    • Line 395: warning: exported method DmCtx.GetDevicePropertiesConfig should have comment or be unexported (golint)
    • Line 398: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • baetyl-go/dmcontext/config.go
    • Line 10: warning: exported type DeviceInfo should have comment or be unexported (golint)
    • Line 16: warning: exported type Topic should have comment or be unexported (golint)
    • Line 24: warning: exported method AccessConfig.UnmarshalYAML should have comment or be unexported (golint)
    • Line 43: warning: exported type AccessConfig should have comment or be unexported (golint)
    • Line 49: warning: exported type ModbusAccessConfig should have comment or be unexported (golint)
    • Line 58: warning: exported type TcpConfig should have comment or be unexported (golint)
    • Line 63: warning: exported type RtuConfig should have comment or be unexported (golint)
    • Line 71: warning: exported type OpcuaAccessConfig should have comment or be unexported (golint)
    • Line 81: warning: exported type OpcuaSecurity should have comment or be unexported (golint)
    • Line 86: warning: exported type OpcuaAuth should have comment or be unexported (golint)
    • Line 91: warning: exported type OpcuaCertificate should have comment or be unexported (golint)
    • Line 96: warning: exported type CustomAccessConfig should have comment or be unexported (golint)
    • Line 98: warning: exported type DeviceProperty should have comment or be unexported (golint)
    • Line 105: warning: exported type PropertyVisitor should have comment or be unexported (golint)
    • Line 111: warning: exported type ModbusVisitor should have comment or be unexported (golint)
    • Line 121: warning: exported type OpcuaVisitor should have comment or be unexported (golint)
    • Line 126: warning: exported type CustomVisitor should have comment or be unexported (golint)
    • Line 128: warning: exported type Event should have comment or be unexported (golint)
    • Line 133: warning: exported type DeviceShadow should have comment or be unexported (golint)
    • baetyl-go/spec/v1/resource.go
    • Line 17: warning: exported const SecretLabel should have comment (or a comment on this block) or be unexported (golint)
    • Line 18: warning: comment on exported const SecretRegistry should be of the form "SecretRegistry ..." (golint)
    • Line 20: warning: comment on exported const SecretConfig should be of the form "SecretConfig ..." (golint)
    • Line 22: warning: comment on exported const SecretCertificate should be of the form "SecretCertificate ..." (golint)
    • Line 24: warning: comment on exported const SecretCustomCertificate should be of the form "SecretCustomCertificate ..." (golint)
    • baetyl-go/mqtt/client.go
    • Line 33: warning: exported method Client.Start should have comment or be unexported (golint)
    • Line 64: warning: comment on exported method Client.SendOrDrop should be of the form "SendOrDrop ..." (golint)
    • baetyl-go/utils/version.go
    • Line 13: warning: exported function Version should have comment or be unexported (golint)
    • Line 17: warning: exported function PrintVersion should have comment or be unexported (golint)
    • baetyl-go/spec/v1/application.go
    • Line 6: warning: exported const AppTypeContainer should have comment (or a comment on this block) or be unexported (golint)
    • Line 69: warning: exported type SecurityContext should have comment or be unexported (golint)
    • Line 79: warning: comment on exported type Device should be of the form "Device ..." (with optional leading article) (golint)
    • Line 143: warning: exported type ServiceFunctionConfig should have comment or be unexported (golint)
    • Line 148: warning: exported type ServiceFunction should have comment or be unexported (golint)
    • baetyl-go/spec/v1/lazy_value.go
    • Line 8: warning: comment on exported type LazyValue should be of the form "LazyValue ..." (with optional leading article) (golint)
    • Line 53: warning: exported method LazyValue.ExactUnmarshal should have comment or be unexported (golint)
    • baetyl-go/http/client.go
    • Line 77: warning: exported method Client.GetURL should have comment or be unexported (golint)
    • Line 81: warning: exported method Client.PostURL should have comment or be unexported (golint)
    • Line 85: warning: exported method Client.SendUrl should have comment or be unexported (golint)
    • baetyl-go/http/server.go
    • Line 9: warning: exported type Server should have comment or be unexported (golint)
    • Line 31: warning: exported method Server.Start should have comment or be unexported (golint)
    • Line 47: warning: exported method Server.Close should have comment or be unexported (golint)
    • baetyl-go/errors/error.go
    • Line 9: warning: exported type Coder should have comment or be unexported (golint)
    • Line 13: warning: exported function New should have comment or be unexported (golint)
    • Line 17: warning: exported function Errorf should have comment or be unexported (golint)
    • Line 21: warning: exported function Cause should have comment or be unexported (golint)
    • Line 25: warning: exported function Trace should have comment or be unexported (golint)
    • Line 37: warning: exported function CodeError should have comment or be unexported (golint)
    • baetyl-go/spec/v1/node.go
    • Line 54: warning: exported type SyncMode should have comment or be unexported (golint)
    • Line 78: warning: exported type NodeView should have comment or be unexported (golint)
    • Line 97: warning: exported type ReportView should have comment or be unexported (golint)
    • Line 134: warning: comment on exported method Desire.DiffWithNil should be of the form "DiffWithNil ..." (golint)
    • Line 198: warning: exported method Report.DeviceInfos should have comment or be unexported (golint)
    • Line 202: warning: exported method Report.SetDeviceInfos should have comment or be unexported (golint)
    • Line 206: warning: exported method Desire.DeviceInfos should have comment or be unexported (golint)
    • Line 210: warning: exported method Desire.SetDeviceInfos should have comment or be unexported (golint)
    • Line 214: warning: exported method Report.AppInfos should have comment or be unexported (golint)
    • Line 217: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 222: warning: exported method Report.SetAppInfos should have comment or be unexported (golint)
    • Line 230: warning: exported method Desire.AppInfos should have comment or be unexported (golint)
    • Line 233: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 238: warning: exported method Desire.SetAppInfos should have comment or be unexported (golint)
    • Line 246: warning: exported method Report.SetAppStats should have comment or be unexported (golint)
    • Line 254: warning: exported method Desire.SetAppStats should have comment or be unexported (golint)
    • Line 262: warning: exported method Report.AppStats should have comment or be unexported (golint)
    • Line 265: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 270: warning: exported method Desire.AppStats should have comment or be unexported (golint)
    • Line 273: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 278: warning: exported method Node.View should have comment or be unexported (golint)
    • Line 602: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • baetyl-go/pubsub/processor.go
    • Line 12: warning: exported var ErrProcessorTimeout should have comment or be unexported (golint)
    • Line 15: warning: exported type Processor should have comment or be unexported (golint)
    • Line 28: warning: exported function NewProcessor should have comment or be unexported (golint)
    • baetyl-go/pki/pki.go
    • Line 12: warning: exported type CertPem should have comment or be unexported (golint)
    • Line 17: warning: exported type PKI should have comment or be unexported (golint)
    • Line 39: warning: exported function NewPKIClient should have comment or be unexported (golint)
    • baetyl-go/spec/v1/sync_report.go
    • Line 5: warning: exported type Status should have comment or be unexported (golint)
    • Line 8: warning: exported const Pending should have comment (or a comment on this block) or be unexported (golint)
    • Line 46: warning: exported type DeviceInfo should have comment or be unexported (golint)
    • Line 66: warning: exported type CoreInfo should have comment or be unexported (golint)
    • baetyl-go/mqtt/counter.go
    • Line 7: warning: exported type Counter should have comment or be unexported (golint)
    • Line 17: warning: comment on exported function NewCounterWithNext should be of the form "NewCounterWithNext ..." (golint)
    • Line 56: warning: exported function NextCounterID should have comment or be unexported (golint)
    • baetyl-go/pubsub/pubsub.go
    • Line 18: warning: exported var ErrPubsubTimeout should have comment or be unexported (golint)
    • Line 21: warning: exported type Pubsub should have comment or be unexported (golint)
    • Line 35: warning: exported function NewPubsub should have comment or be unexported (golint)
    • Line 88: warning: should omit 2nd value from range; this loop is equivalent to `for k := range ...` (golint)
    • baetyl-go/spec/v1/message.go
    • Line 19: warning: comment on exported const MessageResponse should be of the form "MessageResponse ..." (golint)
    • Line 31: warning: comment on exported const MessageDeviceReport should be of the form "MessageDeviceReport ..." (golint)
    • Line 33: warning: comment on exported const MessageDeviceDesire should be of the form "MessageDeviceDesire ..." (golint)
    • Line 35: warning: comment on exported const MessageDeviceDelta should be of the form "MessageDeviceDelta ..." (golint)
    • baetyl-go/utils/flock.go
    • Line 12: warning: exported const DefaultFlockRetry should have comment (or a comment on this block) or be unexported (golint)
    • Line 15: warning: comment on exported function Flock should be of the form "Flock ..." (golint)
    • Line 37: warning: exported function Funlock should have comment or be unexported (golint)
    • baetyl-go/native/port.go
    • Line 8: warning: exported type PortAllocator should have comment or be unexported (golint)
    • Line 14: warning: exported function NewPortAllocator should have comment or be unexported (golint)
    • Line 24: warning: exported method PortAllocator.Allocate should have comment or be unexported (golint)
    • baetyl-go/context/env.go
    • Line 25: warning: exported const RunModeKube should have comment (or a comment on this block) or be unexported (golint)
    • Line 77: warning: comment on exported function FunctionHttpPort should be of the form "FunctionHttpPort ..." (golint)
    • baetyl-go/native/mapping.go
    • Line 18: warning: exported const ServiceMappingFile should have comment (or a comment on this block) or be unexported (golint)
    • Line 21: warning: exported type ServiceMapping should have comment or be unexported (golint)
    • Line 47: warning: exported function NewServiceMapping should have comment or be unexported (golint)
    • Line 89: warning: exported method ServiceMapping.SetServicePorts should have comment or be unexported (golint)
    • Line 105: warning: exported method ServiceMapping.DeleteServicePorts should have comment or be unexported (golint)
    • Line 121: warning: exported method ServiceMapping.GetServiceNextPort should have comment or be unexported (golint)
    • Line 145: warning: exported method ServiceMapping.WatchFile should have comment or be unexported (golint)
    • Line 208: warning: exported method ServiceMapping.Close should have comment or be unexported (golint)
    • baetyl-go/context/platform.go
    • Line 10: warning: exported type PlatformInfo should have comment or be unexported (golint)
    • Line 12: warning: exported function Platform should have comment or be unexported (golint)
    • Line 16: warning: exported function PlatformString should have comment or be unexported (golint)
    • baetyl-go/dmcontext/observer.go
    • Line 16: warning: exported const DeviceTopicRe should have comment (or a comment on this block) or be unexported (golint)
    • Line 28: warning: exported function ParseTopic should have comment or be unexported (golint)
    • baetyl-go/pki/utils.go
    • Line 16: warning: exported const RsaPrivateKeyBlockType should have comment (or a comment on this block) or be unexported (golint)
    • Line 31: warning: exported function GenCertPrivateKey should have comment or be unexported (golint)
    • Line 163: warning: exported function SigAlgorithmType should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign95%

IneffAssign detects ineffectual assignments in Go code.


misspell96%

Misspell Finds commonly misspelled English words

    • baetyl-go/spec/v1/resource.go
    • Line 18: warning: "speical" is a misspelling of "special" (misspell)
    • Line 20: warning: "speical" is a misspelling of "special" (misspell)
    • Line 22: warning: "speical" is a misspelling of "special" (misspell)
    • Line 24: warning: "speical" is a misspelling of "special" (misspell)