Showing 75 of 517 total issues
Method VM.init
has 5 return statements (exceeds 4 allowed). Confirmed
func (vm *VM) init(globals Object, args ...Object) (Object, error) {
if vm.bytecode == nil || vm.bytecode.Main == nil {
return nil, errors.New("invalid Bytecode")
}
Method VM.xOpCallName
has 5 return statements (exceeds 4 allowed). Confirmed
func (vm *VM) xOpCallName() error {
numArgs := int(vm.curInsts[vm.ip+1])
flags := int(vm.curInsts[vm.ip+2]) // 0 or 1
obj := vm.stack[vm.sp-numArgs-2]
name := vm.stack[vm.sp-1]
Method Scanner.Scan
has 5 return statements (exceeds 4 allowed). Open
func (s *Scanner) Scan() (
tok token.Token,
literal string,
pos Pos,
) {
Method Bool.BinaryOp
has 5 return statements (exceeds 4 allowed). Open
func (o Bool) BinaryOp(tok token.Token, right Object) (Object, error) {
bval := Int(0)
if o {
bval = Int(1)
}
Method Compiler.compileImportExpr
has 5 return statements (exceeds 4 allowed). Open
func (c *Compiler) compileImportExpr(node *parser.ImportExpr) error {
moduleName := node.ModuleName
if moduleName == "" {
return c.errorf(node, "empty module name")
}
Method SymbolTable.SetParams
has 5 return statements (exceeds 4 allowed). Open
func (st *SymbolTable) SetParams(params ...string) error {
if len(params) == 0 {
return nil
}
Method Scanner.scanEscape
has 5 return statements (exceeds 4 allowed). Open
func (s *Scanner) scanEscape(quote rune) bool {
offs := s.offset
var n int
var base, max uint32
Method Map.Equal
has 5 return statements (exceeds 4 allowed). Open
func (o Map) Equal(right Object) bool {
v, ok := right.(Map)
if !ok {
return false
}
Method Parser.parseSimpleStmt
has 5 return statements (exceeds 4 allowed). Open
func (p *Parser) parseSimpleStmt(forIn bool) Stmt {
if p.trace {
defer untracep(tracep(p, "SimpleStmt"))
}
Function Compile
has 5 return statements (exceeds 4 allowed). Open
func Compile(script []byte, opts CompilerOptions) (*Bytecode, error) {
fileSet := parser.NewFileSet()
moduleName := opts.ModulePath
if moduleName == "" {
Method Scanner.findLineEnd
has 5 return statements (exceeds 4 allowed). Open
func (s *Scanner) findLineEnd() bool {
// initial '/' already consumed
defer func(offs int) {
// reset scanner state to where it was upon calling findLineEnd
Method Parser.parseSimpleStmt
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func (p *Parser) parseSimpleStmt(forIn bool) Stmt {
if p.trace {
defer untracep(tracep(p, "SimpleStmt"))
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Scanner.scanComment
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func (s *Scanner) scanComment() string {
// initial '/' already consumed; s.ch == '/' || s.ch == '*'
offs := s.offset - 1 // position of initial '/'
var numCR int
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Compiler.compileTryStmt
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func (c *Compiler) compileTryStmt(node *parser.TryStmt) error {
/*
// create a single symbol table for try-catch-finally
// any `return` statement in finally block ignores already thrown error.
try {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Compiler.compileIfStmt
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func (c *Compiler) compileIfStmt(node *parser.IfStmt) error {
// open new symbol table for the statement
c.symbolTable = c.symbolTable.Fork(true)
defer func() {
c.symbolTable = c.symbolTable.Parent(false)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"