Preparing report...

Report for github.com/zgwit/iot-master

(v0.0.0-20220216041721-9673bfb5ae29)

A+    Excellent!    Found 28 issues across 90 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!


gocyclo96%

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.

    • model/type.go
    • Line 134: warning: cyclomatic complexity 20 of function (DataType).Encode() is high (> 15) (gocyclo)
    • Line 200: warning: cyclomatic complexity 20 of function (DataType).Decode() is high (> 15) (gocyclo)
    • Line 28: warning: cyclomatic complexity 19 of function (DataType).Parse() is high (> 15) (gocyclo)
    • master/device.go
    • Line 67: warning: cyclomatic complexity 17 of function (*Device).Init() is high (> 15) (gocyclo)

golint73%

Golint is a linter for Go source code.

    • web/app.go
    • Line 16: warning: exported function Serve should have comment or be unexported (golint)
    • model/checker.go
    • Line 16: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • protocol/omron/hostlink.go
    • Line 10: warning: exported type FinsHostLink should have comment or be unexported (golint)
    • Line 15: warning: exported function NewFinsHostLink should have comment or be unexported (golint)
    • Line 64: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • Line 89: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • protocol/omron/address.go
    • Line 9: warning: exported type Command should have comment or be unexported (golint)
    • Line 14: warning: exported type Address should have comment or be unexported (golint)
    • Line 34: warning: exported function ParseAddress should have comment or be unexported (golint)
    • Line 58: 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)
    • protocol/siemens/s7.go
    • Line 36: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 109: warning: exported type S7 should have comment or be unexported (golint)
    • protocol/mitsubishi/a3c1.go
    • Line 20: warning: exported function NewA3C1 should have comment or be unexported (golint)
    • Line 30: warning: exported method A3C1.BuildCommand should have comment or be unexported (golint)
    • protocol/mitsubishi/qna3e_binary.go
    • Line 20: warning: exported function NewA3EBinaryAdapter should have comment or be unexported (golint)
    • Line 44: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • Line 55: warning: exported method A3EBinaryAdapter.BuildCommand should have comment or be unexported (golint)
    • protocol/modbus/rtu.go
    • Line 65: warning: exported method RTU.OnData should have comment or be unexported (golint)
    • Line 140: warning: exported method RTU.ImmediateRead should have comment or be unexported (golint)
    • protocol/omron/fins.go
    • Line 10: warning: exported type Fins should have comment or be unexported (golint)
    • Line 15: warning: exported function NewFins should have comment or be unexported (golint)
    • Line 35: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • Line 46: warning: exported method Fins.Handshake should have comment or be unexported (golint)
    • Line 91: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • Line 119: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • protocol/omron/udp.go
    • Line 10: warning: exported type UdpFrame should have comment or be unexported (golint)
    • Line 42: warning: exported type FinsUdp should have comment or be unexported (golint)
    • Line 47: warning: exported function NewFinsUdp should have comment or be unexported (golint)
    • Line 89: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • Line 113: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • master/device.go
    • Line 30: warning: exported function NewDevice should have comment or be unexported (golint)
    • Line 238: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • master/master.go
    • Line 69: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 159: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • protocol/modbus/tcp.go
    • Line 81: warning: exported method TCP.OnData should have comment or be unexported (golint)
    • Line 144: warning: exported method TCP.ImmediateRead should have comment or be unexported (golint)
    • model/type.go
    • Line 15: warning: exported const TypeBIT should have comment (or a comment on this block) or be unexported (golint)
    • protocol/mitsubishi/address.go
    • Line 17: warning: exported type Address should have comment or be unexported (golint)
    • Line 57: warning: exported function ParseAddress should have comment or be unexported (golint)
    • Line 81: warning: exported function ParseA1EAddress should have comment or be unexported (golint)
    • protocol/mitsubishi/qna3e.go
    • Line 21: warning: exported function NewA3EAdapter should have comment or be unexported (golint)
    • Line 45: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • Line 56: warning: exported method A3EAdapter.BuildCommand should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign96%

IneffAssign detects ineffectual assignments in Go code.

    • model/type.go
    • Line 32: warning: ineffectual assignment to dt (ineffassign)
    • Line 34: warning: ineffectual assignment to dt (ineffassign)
    • Line 38: warning: ineffectual assignment to dt (ineffassign)
    • Line 42: warning: ineffectual assignment to dt (ineffassign)
    • Line 46: warning: ineffectual assignment to dt (ineffassign)
    • Line 50: warning: ineffectual assignment to dt (ineffassign)
    • Line 56: warning: ineffectual assignment to dt (ineffassign)
    • Line 60: warning: ineffectual assignment to dt (ineffassign)
    • Line 62: warning: ineffectual assignment to dt (ineffassign)
    • Line 66: warning: ineffectual assignment to dt (ineffassign)

misspell98%

Misspell Finds commonly misspelled English words