Showing 324 of 517 total issues

Method SimpleOptimizer.slowEvalExpr has 87 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (so *SimpleOptimizer) slowEvalExpr(expr parser.Expr) (parser.Expr, bool) {
    st := NewSymbolTable().
        EnableParams(false).
        DisableBuiltin(so.disabledBuiltins...).
        DisableBuiltin(so.scope.shadowedBuiltins()...)
Severity: Major
Found in optimizer.go - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        case *parser.UintLit:
            switch op {
            case token.Not:
                v := expr.Value == 0
                return &parser.BoolLit{
    Severity: Major
    Found in optimizer.go and 1 other location - About 2 hrs to fix
    optimizer.go on lines 497..522

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 207.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        case *parser.IntLit:
            switch op {
            case token.Not:
                v := expr.Value == 0
                return &parser.BoolLit{
    Severity: Major
    Found in optimizer.go and 1 other location - About 2 hrs to fix
    optimizer.go on lines 523..548

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 207.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    SymbolTable has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type SymbolTable struct {
        parent           *SymbolTable
        maxDefinition    int
        numDefinition    int
        numParams        int
    Severity: Minor
    Found in symbol_table.go - About 2 hrs to fix

      Method Int.BinaryOp has 76 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

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

        Method Uint.BinaryOp has 76 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method Parser.parseSimpleStmt has 71 lines of code (exceeds 50 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 1 hr to fix

            Method VM.xOpUnary has 69 lines of code (exceeds 50 allowed). Consider refactoring.
            Confirmed

            func (vm *VM) xOpUnary() error {
                tok := token.Token(vm.curInsts[vm.ip+1])
                right := vm.stack[vm.sp-1]
                var value Object
            
            
            Severity: Minor
            Found in vm.go - About 1 hr to fix

              Method SimpleOptimizer.unaryop has 69 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (so *SimpleOptimizer) unaryop(
                  op token.Token,
                  expr parser.Expr,
              ) (parser.Expr, bool) {
              
              
              Severity: Minor
              Found in optimizer.go - About 1 hr to fix

                Method Compiler.compileImportExpr has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (c *Compiler) compileImportExpr(node *parser.ImportExpr) error {
                    moduleName := node.ModuleName
                    if moduleName == "" {
                        return c.errorf(node, "empty module name")
                    }
                Severity: Minor
                Found in compiler_nodes.go - About 1 hr to fix

                  Method VM.xOpSliceIndex has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                  Confirmed

                  func (vm *VM) xOpSliceIndex() error {
                      obj := vm.stack[vm.sp-3]
                      left := vm.stack[vm.sp-2]
                      right := vm.stack[vm.sp-1]
                      vm.stack[vm.sp-3] = nil
                  Severity: Minor
                  Found in vm.go - About 1 hr to fix

                    Method Scanner.scanNumber has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (s *Scanner) scanNumber(seenDecimalPoint bool) (tok token.Token, lit string) {
                        // digitVal(s.ch) < 10
                        offs := s.offset
                        tok = token.Int
                    
                    
                    Severity: Minor
                    Found in parser/scanner.go - About 1 hr to fix

                      Method VM.xOpUnary has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                      Confirmed

                      func (vm *VM) xOpUnary() error {
                          tok := token.Token(vm.curInsts[vm.ip+1])
                          right := vm.stack[vm.sp-1]
                          var value Object
                      
                      
                      Severity: Minor
                      Found in vm.go - About 1 hr 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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          case Uint:
                              switch tok {
                              case token.Add:
                                  return o + Char(v), nil
                              case token.Sub:
                      Severity: Major
                      Found in numeric.go and 1 other location - About 1 hr to fix
                      numeric.go on lines 527..541

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 146.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          case Char:
                              switch tok {
                              case token.Add:
                                  return Char(o) + v, nil
                              case token.Sub:
                      Severity: Major
                      Found in numeric.go and 1 other location - About 1 hr to fix
                      numeric.go on lines 119..133

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 146.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          case Int:
                              switch tok {
                              case token.Add:
                                  return o + Char(v), nil
                              case token.Sub:
                      Severity: Major
                      Found in numeric.go and 1 other location - About 1 hr to fix
                      numeric.go on lines 542..556

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 146.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          case Char:
                              switch tok {
                              case token.Add:
                                  return Char(o) + v, nil
                              case token.Sub:
                      Severity: Major
                      Found in numeric.go and 1 other location - About 1 hr to fix
                      numeric.go on lines 265..279

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 146.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          case token.Break:
                              curLoop := c.currentLoop()
                              if curLoop == nil {
                                  return c.errorf(node, "break not allowed outside loop")
                              }
                      Severity: Major
                      Found in compiler_nodes.go and 1 other location - About 1 hr to fix
                      compiler_nodes.go on lines 599..612

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 140.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          case token.Continue:
                              curLoop := c.currentLoop()
                              if curLoop == nil {
                                  return c.errorf(node, "continue not allowed outside loop")
                              }
                      Severity: Major
                      Found in compiler_nodes.go and 1 other location - About 1 hr to fix
                      compiler_nodes.go on lines 585..598

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 140.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Method Compiler.compileForInStmt has 54 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (c *Compiler) compileForInStmt(stmt *parser.ForInStmt) error {
                          c.symbolTable = c.symbolTable.Fork(true)
                          defer func() {
                              c.symbolTable = c.symbolTable.Parent(false)
                          }()
                      Severity: Minor
                      Found in compiler_nodes.go - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language