Showing 75 of 517 total issues

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
Severity: Major
Found in parser/scanner.go - About 35 mins to fix

    Method SymbolTable.SetParams has 5 return statements (exceeds 4 allowed).
    Open

    func (st *SymbolTable) SetParams(params ...string) error {
        if len(params) == 0 {
            return nil
        }
    
    
    Severity: Major
    Found in symbol_table.go - About 35 mins to fix

      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
      Severity: Major
      Found in parser/scanner.go - About 35 mins to fix

        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 == "" {
        Severity: Major
        Found in compiler.go - About 35 mins to fix

          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")
              }
          Severity: Major
          Found in compiler_nodes.go - About 35 mins to fix

            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]
            Severity: Major
            Found in vm.go - About 35 mins to fix

              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")
                  }
              
              
              Severity: Major
              Found in vm.go - About 35 mins to fix

                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)
                    }
                Severity: Major
                Found in objects.go - About 35 mins to fix

                  Method Char.BinaryOp has 5 return statements (exceeds 4 allowed).
                  Open

                  func (o Char) BinaryOp(tok token.Token, right Object) (Object, error) {
                      switch v := right.(type) {
                      case Char:
                          switch tok {
                          case token.Add:
                  Severity: Major
                  Found in numeric.go - About 35 mins to fix

                    Method Array.IndexSet has 5 return statements (exceeds 4 allowed).
                    Open

                    func (o Array) IndexSet(index, value Object) error {
                        switch v := index.(type) {
                        case Int:
                            idx := int(v)
                            if idx >= 0 && idx < len(o) {
                    Severity: Major
                    Found in objects.go - About 35 mins to fix

                      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"))
                          }
                      
                      
                      Severity: Major
                      Found in parser/parser.go - About 35 mins to fix

                        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
                        
                        
                        Severity: Minor
                        Found in parser/scanner.go - About 25 mins to fix

                        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 {
                        Severity: Minor
                        Found in compiler_nodes.go - About 25 mins to fix

                        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 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"))
                            }
                        
                        
                        Severity: Minor
                        Found in parser/parser.go - About 25 mins to fix

                        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)
                        Severity: Minor
                        Found in compiler_nodes.go - About 25 mins to fix

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language