Preparing report...

Report for github.com/qiniu/text

A    Great!    Found 23 issues across 37 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!


gocyclo81%

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.

    • text/tpl/scanner.go
    • Line 619: warning: cyclomatic complexity 55 of function (*Scanner).Scan() is high (> 15) (gocyclo)
    • Line 300: warning: cyclomatic complexity 19 of function (*Scanner).scanNumber() is high (> 15) (gocyclo)

golint51%

Golint is a linter for Go source code.

    • text/tpl/cmplx/cmplx.go
    • Line 15: warning: exported const Grammar should have comment or be unexported (golint)
    • Line 31: warning: exported var ErrUnsupportedRetType should have comment or be unexported (golint)
    • Line 37: warning: exported function Abs should have comment or be unexported (golint)
    • Line 41: warning: exported function Neg should have comment or be unexported (golint)
    • Line 45: warning: exported function Mul should have comment or be unexported (golint)
    • Line 49: warning: exported function Quo should have comment or be unexported (golint)
    • Line 53: warning: exported function Add should have comment or be unexported (golint)
    • Line 57: warning: exported function Sub should have comment or be unexported (golint)
    • Line 61: warning: exported function Phase should have comment or be unexported (golint)
    • Line 65: warning: exported function Rect should have comment or be unexported (golint)
    • Line 74: warning: exported function Real should have comment or be unexported (golint)
    • Line 78: warning: exported function Imag should have comment or be unexported (golint)
    • Line 82: warning: exported function Complex should have comment or be unexported (golint)
    • Line 91: warning: exported type Stack should have comment or be unexported (golint)
    • Line 93: warning: exported function NewStack should have comment or be unexported (golint)
    • Line 99: warning: exported method Stack.Clear should have comment or be unexported (golint)
    • Line 104: warning: exported method Stack.Push should have comment or be unexported (golint)
    • Line 109: warning: exported method Stack.PushReal should have comment or be unexported (golint)
    • Line 114: warning: exported method Stack.PushImag should have comment or be unexported (golint)
    • Line 120: warning: exported method Stack.Pop should have comment or be unexported (golint)
    • Line 130: warning: exported method Stack.PushRet should have comment or be unexported (golint)
    • Line 151: warning: exported method Stack.PopArgs should have comment or be unexported (golint)
    • Line 166: warning: exported function Arity should have comment or be unexported (golint)
    • Line 173: warning: exported type Calculator should have comment or be unexported (golint)
    • Line 177: warning: exported function New should have comment or be unexported (golint)
    • Line 183: warning: exported method Calculator.Grammar should have comment or be unexported (golint)
    • Line 188: warning: exported method Calculator.Fntable should have comment or be unexported (golint)
    • Line 193: warning: exported method Calculator.Stack should have comment or be unexported (golint)
    • Line 198: warning: exported method Calculator.Ret should have comment or be unexported (golint)
    • Line 205: warning: exported method Calculator.Call should have comment or be unexported (golint)
    • Line 228: warning: exported var Fntable should have comment or be unexported (golint)
    • text/tpl/number/number.go
    • Line 12: warning: comment on exported const Grammar should be of the form "Grammar ..." (golint)
    • Line 30: warning: exported var ErrUnsupportedRetType should have comment or be unexported (golint)
    • Line 36: warning: exported function Neg should have comment or be unexported (golint)
    • Line 40: warning: exported function Mul should have comment or be unexported (golint)
    • Line 44: warning: exported function Quo should have comment or be unexported (golint)
    • Line 48: warning: exported function Add should have comment or be unexported (golint)
    • Line 52: warning: exported function Sub should have comment or be unexported (golint)
    • Line 56: warning: exported function Inf should have comment or be unexported (golint)
    • Line 64: warning: exported function Jn should have comment or be unexported (golint)
    • Line 68: warning: exported function Yn should have comment or be unexported (golint)
    • Line 72: warning: exported function Ldexp should have comment or be unexported (golint)
    • Line 76: warning: exported function Pow10 should have comment or be unexported (golint)
    • Line 80: warning: exported function Max should have comment or be unexported (golint)
    • Line 95: warning: exported function Min should have comment or be unexported (golint)
    • Line 112: warning: exported type Stack should have comment or be unexported (golint)
    • Line 114: warning: exported function NewStack should have comment or be unexported (golint)
    • Line 120: warning: exported method Stack.Clear should have comment or be unexported (golint)
    • Line 125: warning: exported method Stack.Push should have comment or be unexported (golint)
    • Line 130: warning: exported method Stack.PushIdent should have comment or be unexported (golint)
    • Line 150: warning: exported method Stack.Pop should have comment or be unexported (golint)
    • Line 160: warning: exported method Stack.PushRet should have comment or be unexported (golint)
    • Line 179: warning: exported method Stack.PopArgs should have comment or be unexported (golint)
    • Line 194: warning: exported function Arity should have comment or be unexported (golint)
    • Line 201: warning: exported type Calculator should have comment or be unexported (golint)
    • Line 205: warning: exported function New should have comment or be unexported (golint)
    • Line 211: warning: exported method Calculator.Grammar should have comment or be unexported (golint)
    • Line 216: warning: exported method Calculator.Fntable should have comment or be unexported (golint)
    • Line 221: warning: exported method Calculator.Stack should have comment or be unexported (golint)
    • Line 226: warning: exported method Calculator.Ret should have comment or be unexported (golint)
    • Line 233: warning: exported method Calculator.Call should have comment or be unexported (golint)
    • Line 256: warning: exported var Fntable should have comment or be unexported (golint)
    • text/tpl/token.go
    • Line 11: warning: exported const ILLEGAL should have comment (or a comment on this block) or be unexported (golint)
    • Line 54: warning: don't use underscores in Go names; const operator_beg should be operatorBeg (golint)
    • Line 56: warning: exported const SHL should have comment (or a comment on this block) or be unexported (golint)
    • text/tpl/qlang/cl/ctrl.go
    • Line 11: warning: exported var ErrIfCondNotBoolean should have comment or be unexported (golint)
    • Line 17: warning: exported method Interpreter.Or should have comment or be unexported (golint)
    • Line 32: warning: exported method Interpreter.And should have comment or be unexported (golint)
    • Line 47: warning: exported method Interpreter.If should have comment or be unexported (golint)
    • Line 87: warning: exported method Interpreter.Switch should have comment or be unexported (golint)
    • Line 134: warning: exported method Interpreter.For should have comment or be unexported (golint)
    • text/tpl/qlang/engine.go
    • Line 12: warning: exported type Options should have comment or be unexported (golint)
    • Line 15: warning: exported var InsertSemis should have comment or be unexported (golint)
    • Line 20: warning: exported type Qlang should have comment or be unexported (golint)
    • Line 25: warning: exported function New should have comment or be unexported (golint)
    • Line 35: warning: exported method Qlang.Exec should have comment or be unexported (golint)
    • Line 40: warning: exported method Qlang.SafeExec should have comment or be unexported (golint)
    • Line 61: warning: exported method Qlang.SafeEval should have comment or be unexported (golint)
    • Line 66: warning: exported function Import should have comment or be unexported (golint)
    • Line 71: warning: exported function SetAutoCall should have comment or be unexported (golint)
    • text/tpl/extractor/extractor.go
    • Line 21: warning: exported function GetValue should have comment or be unexported (golint)
    • Line 59: warning: exported type Options should have comment or be unexported (golint)
    • Line 65: warning: exported type Engine should have comment or be unexported (golint)
    • Line 76: warning: exported var InsertSemis should have comment or be unexported (golint)
    • Line 79: warning: exported function New should have comment or be unexported (golint)
    • Line 157: warning: exported method Engine.Result should have comment or be unexported (golint)
    • Line 162: warning: exported method Engine.Parse should have comment or be unexported (golint)
    • Line 171: warning: exported method Engine.SafeParse should have comment or be unexported (golint)
    • Line 193: warning: exported method Engine.Extract should have comment or be unexported (golint)
    • Line 198: warning: exported method Engine.SafeExtract should have comment or be unexported (golint)
    • text/tpl/qlang/lib/builtin/boolean.go
    • Line 5: warning: exported function Not should have comment or be unexported (golint)
    • Line 13: warning: exported function LT should have comment or be unexported (golint)
    • Line 46: warning: exported function GT should have comment or be unexported (golint)
    • Line 79: warning: exported function LE should have comment or be unexported (golint)
    • Line 112: warning: exported function GE should have comment or be unexported (golint)
    • Line 145: warning: exported function EQ should have comment or be unexported (golint)
    • Line 150: warning: exported function NE should have comment or be unexported (golint)
    • text/tpl/qlang/cl/class.go
    • Line 14: warning: exported var ErrNewWithoutClassName should have comment or be unexported (golint)
    • Line 20: warning: exported type FunctionInfo should have comment or be unexported (golint)
    • Line 26: warning: exported type Class should have comment or be unexported (golint)
    • Line 32: warning: exported type Object should have comment or be unexported (golint)
    • Line 37: warning: exported method Object.SetVar should have comment or be unexported (golint)
    • Line 45: warning: exported function SetMemberVar should have comment or be unexported (golint)
    • Line 100: warning: exported method Interpreter.MemberFuncDecl should have comment or be unexported (golint)
    • Line 120: warning: exported method Interpreter.Class should have comment or be unexported (golint)
    • Line 129: warning: exported method Interpreter.New should have comment or be unexported (golint)
    • Line 168: warning: exported method Interpreter.MemberRef should have comment or be unexported (golint)
    • text/tpl/qlang/cl/qlang.go
    • Line 14: warning: exported const Grammar should have comment or be unexported (golint)
    • Line 79: warning: exported var ErrRefWithoutObject should have comment or be unexported (golint)
    • Line 85: warning: exported type Stack should have comment or be unexported (golint)
    • Line 87: warning: exported function NewStack should have comment or be unexported (golint)
    • Line 93: warning: exported method Stack.Push should have comment or be unexported (golint)
    • Line 98: warning: exported method Stack.PushInt should have comment or be unexported (golint)
    • Line 103: warning: exported method Stack.PushFloat should have comment or be unexported (golint)
    • Line 108: warning: exported method Stack.PushByte should have comment or be unexported (golint)
    • Line 120: warning: exported method Stack.PushString should have comment or be unexported (golint)
    • Line 129: warning: exported method Stack.Pop should have comment or be unexported (golint)
    • Line 147: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 159: warning: exported method Stack.PushRet should have comment or be unexported (golint)
    • Line 176: warning: exported method Stack.PopArgs should have comment or be unexported (golint)
    • Line 236: warning: exported function PushNil should have comment or be unexported (golint)
    • Line 241: warning: exported function Arity should have comment or be unexported (golint)
    • Line 246: warning: exported function Code should have comment or be unexported (golint)
    • Line 251: warning: exported function Index should have comment or be unexported (golint)
    • Line 278: warning: exported type Defer should have comment or be unexported (golint)
    • Line 283: warning: exported type Interpreter should have comment or be unexported (golint)
    • Line 293: warning: exported function New should have comment or be unexported (golint)
    • Line 300: warning: exported method Interpreter.Grammar should have comment or be unexported (golint)
    • Line 305: warning: exported method Interpreter.Fntable should have comment or be unexported (golint)
    • Line 310: warning: exported method Interpreter.Vars should have comment or be unexported (golint)
    • Line 315: warning: exported method Interpreter.Var should have comment or be unexported (golint)
    • Line 321: warning: exported method Interpreter.SetVar should have comment or be unexported (golint)
    • Line 326: warning: exported method Interpreter.Stack should have comment or be unexported (golint)
    • Line 331: warning: exported method Interpreter.Ret should have comment or be unexported (golint)
    • Line 338: warning: exported method Interpreter.VMap should have comment or be unexported (golint)
    • Line 344: warning: exported method Interpreter.VSlice should have comment or be unexported (golint)
    • Line 350: warning: exported method Interpreter.VCall should have comment or be unexported (golint)
    • text/doc.go
    • Line 4: warning: a blank import should be only in a main or test package, or have a comment justifying it (golint)
    • text/tpl/qlang/spec/spec.go
    • Line 11: warning: error var Undefined should have name of the form ErrFoo (golint)
    • Line 11: warning: exported var Undefined should have comment or be unexported (golint)
    • Line 47: warning: exported var ChanIn should have comment or be unexported (golint)
    • Line 64: warning: exported var Fntable should have comment or be unexported (golint)
    • Line 83: warning: exported var SafeMode should have comment or be unexported (golint)
    • Line 85: warning: exported function Import should have comment or be unexported (golint)
    • Line 123: warning: exported var DumpStack should have comment or be unexported (golint)
    • Line 127: warning: exported function SetAutoCall should have comment or be unexported (golint)
    • Line 131: warning: exported function SetDumpStack should have comment or be unexported (golint)
    • text/tpl/qlang/lib/builtin/number.go
    • Line 11: warning: exported function Inc should have comment or be unexported (golint)
    • Line 22: warning: exported function Dec should have comment or be unexported (golint)
    • Line 33: warning: exported function Neg should have comment or be unexported (golint)
    • Line 44: warning: exported function Float should have comment or be unexported (golint)
    • Line 57: warning: exported function Int should have comment or be unexported (golint)
    • Line 70: warning: exported function Byte should have comment or be unexported (golint)
    • Line 83: warning: exported function String should have comment or be unexported (golint)
    • Line 96: warning: exported function Mul should have comment or be unexported (golint)
    • Line 117: warning: exported function Quo should have comment or be unexported (golint)
    • Line 138: warning: exported function Mod should have comment or be unexported (golint)
    • Line 148: warning: exported function Add should have comment or be unexported (golint)
    • Line 173: warning: exported function Sub should have comment or be unexported (golint)
    • Line 194: warning: exported function Max should have comment or be unexported (golint)
    • Line 209: warning: exported function Min should have comment or be unexported (golint)
    • text/tpl/qlang/cl/interpreter/interpret.go
    • Line 16: warning: exported var ErrNotObject should have comment or be unexported (golint)
    • Line 21: warning: exported type Options should have comment or be unexported (golint)
    • Line 26: warning: exported type Engine should have comment or be unexported (golint)
    • Line 38: warning: exported var InsertSemis should have comment or be unexported (golint)
    • Line 113: warning: exported function New should have comment or be unexported (golint)
    • Line 132: warning: exported method Engine.Exec should have comment or be unexported (golint)
    • Line 151: warning: exported method Engine.Eval should have comment or be unexported (golint)
    • Line 320: warning: exported method Engine.EvalCode should have comment or be unexported (golint)
    • Line 332: warning: exported function ClassOf should have comment or be unexported (golint)
    • Line 340: warning: exported function NewRuntimeError should have comment or be unexported (golint)
    • Line 347: warning: exported var Exports should have comment or be unexported (golint)
    • text/tpl/rat/big.go
    • Line 14: warning: exported const Grammar should have comment or be unexported (golint)
    • Line 29: warning: exported var ErrUnsupportedRetType should have comment or be unexported (golint)
    • Line 40: warning: exported function Denom should have comment or be unexported (golint)
    • Line 44: warning: exported function Num should have comment or be unexported (golint)
    • Line 48: warning: exported function Abs should have comment or be unexported (golint)
    • Line 52: warning: exported function Inv should have comment or be unexported (golint)
    • Line 56: warning: exported function Neg should have comment or be unexported (golint)
    • Line 60: warning: exported function Mul should have comment or be unexported (golint)
    • Line 64: warning: exported function Quo should have comment or be unexported (golint)
    • Line 68: warning: exported function Add should have comment or be unexported (golint)
    • Line 72: warning: exported function Sub should have comment or be unexported (golint)
    • Line 76: warning: exported function Max should have comment or be unexported (golint)
    • Line 91: warning: exported function Min should have comment or be unexported (golint)
    • Line 108: warning: exported type Stack should have comment or be unexported (golint)
    • Line 110: warning: exported function NewStack should have comment or be unexported (golint)
    • Line 116: warning: exported method Stack.Clear should have comment or be unexported (golint)
    • Line 121: warning: exported method Stack.Push should have comment or be unexported (golint)
    • Line 126: warning: exported method Stack.PushInt should have comment or be unexported (golint)
    • Line 132: warning: exported method Stack.PushString should have comment or be unexported (golint)
    • Line 138: warning: exported method Stack.Pop should have comment or be unexported (golint)
    • Line 148: warning: exported method Stack.PushRet should have comment or be unexported (golint)
    • Line 160: warning: exported method Stack.PopArgs should have comment or be unexported (golint)
    • Line 175: warning: exported function Arity should have comment or be unexported (golint)
    • Line 182: warning: exported type Calculator should have comment or be unexported (golint)
    • Line 186: warning: exported function New should have comment or be unexported (golint)
    • Line 192: warning: exported method Calculator.Grammar should have comment or be unexported (golint)
    • Line 197: warning: exported method Calculator.Fntable should have comment or be unexported (golint)
    • Line 202: warning: exported method Calculator.Stack should have comment or be unexported (golint)
    • Line 207: warning: exported method Calculator.Ret should have comment or be unexported (golint)
    • Line 214: warning: exported method Calculator.Call should have comment or be unexported (golint)
    • Line 237: warning: exported var Fntable should have comment or be unexported (golint)
    • text/tpl/qlang/cl/function.go
    • Line 16: warning: exported var ErrFunctionWithoutBody should have comment or be unexported (golint)
    • Line 21: warning: exported var ErrReturn should have comment or be unexported (golint)
    • Line 26: warning: exported method Stack.BaseFrame should have comment or be unexported (golint)
    • Line 31: warning: exported method Stack.SetFrame should have comment or be unexported (golint)
    • Line 36: warning: exported function PushName should have comment or be unexported (golint)
    • Line 43: warning: exported method Interpreter.Clear should have comment or be unexported (golint)
    • Line 48: warning: exported method Interpreter.Unset should have comment or be unexported (golint)
    • Line 53: warning: exported method Interpreter.Inc should have comment or be unexported (golint)
    • Line 62: warning: exported method Interpreter.Dec should have comment or be unexported (golint)
    • Line 89: warning: exported method Interpreter.AddAssign should have comment or be unexported (golint)
    • Line 102: warning: exported method Interpreter.SubAssign should have comment or be unexported (golint)
    • Line 115: warning: exported method Interpreter.MulAssign should have comment or be unexported (golint)
    • Line 128: warning: exported method Interpreter.QuoAssign should have comment or be unexported (golint)
    • Line 141: warning: exported method Interpreter.ModAssign should have comment or be unexported (golint)
    • Line 154: warning: exported method Interpreter.MultiAssign should have comment or be unexported (golint)
    • Line 184: warning: exported method Interpreter.Assign should have comment or be unexported (golint)
    • Line 215: warning: exported method Interpreter.Ref should have comment or be unexported (golint)
    • Line 255: warning: exported method Interpreter.Function should have comment or be unexported (golint)
    • Line 277: warning: exported method Interpreter.Return should have comment or be unexported (golint)
    • Line 302: warning: exported method Interpreter.ExecDefers should have comment or be unexported (golint)
    • Line 312: warning: exported method Interpreter.Defer should have comment or be unexported (golint)
    • Line 323: warning: exported method Interpreter.Recover should have comment or be unexported (golint)
    • Line 336: warning: exported type Function should have comment or be unexported (golint)
    • Line 345: warning: exported method Function.Call should have comment or be unexported (golint)
    • Line 406: warning: exported method Interpreter.Main should have comment or be unexported (golint)
    • text/tpl/extractor/document.go
    • Line 13: warning: exported type Cons should have comment or be unexported (golint)
    • Line 20: warning: exported type ConsList should have comment or be unexported (golint)
    • Line 26: warning: exported type Node should have comment or be unexported (golint)
    • text/tpl/qlang/lib/builtin/builtin.go
    • Line 13: warning: exported function Panic should have comment or be unexported (golint)
    • Line 17: warning: exported function Panicf should have comment or be unexported (golint)
    • Line 27: warning: exported function Mkmap should have comment or be unexported (golint)
    • Line 32: warning: exported function MapOf should have comment or be unexported (golint)
    • Line 37: warning: exported function MapFrom should have comment or be unexported (golint)
    • Line 111: warning: exported function Delete should have comment or be unexported (golint)
    • Line 116: warning: exported function Set should have comment or be unexported (golint)
    • Line 149: warning: exported function Get should have comment or be unexported (golint)
    • Line 164: warning: exported function Len should have comment or be unexported (golint)
    • Line 175: warning: exported function Cap should have comment or be unexported (golint)
    • Line 186: warning: exported function SubSlice should have comment or be unexported (golint)
    • Line 201: warning: exported function Append should have comment or be unexported (golint)
    • Line 239: warning: exported function Slice should have comment or be unexported (golint)
    • Line 264: warning: exported function SliceFrom should have comment or be unexported (golint)
    • Line 283: warning: exported function SliceOf should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign97%

IneffAssign detects ineffectual assignments in Go code.


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!