goruby/goruby

View on GitHub

Showing 36 of 60 total issues

Function kernelRequire has 7 return statements (exceeds 4 allowed).
Open

func kernelRequire(context CallContext, args ...RubyObject) (RubyObject, error) {
    if len(args) != 1 {
        return nil, NewWrongNumberOfArgumentsError(1, len(args))
    }
    name, ok := args[0].(*String)
Severity: Major
Found in object/kernel.go - About 45 mins to fix

    Method parser.parseContextCallExpression has 6 return statements (exceeds 4 allowed).
    Open

    func (p *parser) parseContextCallExpression(context ast.Expression) ast.Expression {
        if p.trace {
            defer un(trace(p, "parseContextCallExpression"))
        }
        contextCallExpression := &ast.ContextCallExpression{Token: p.curToken, Context: context}
    Severity: Major
    Found in parser/parser.go - About 40 mins to fix

      Function Parent has 6 return statements (exceeds 4 allowed).
      Open

      func Parent(root, child Node) (Node, bool) {
          if root == child {
              return nil, false
          }
          if !Contains(root, child) {
      Severity: Major
      Found in ast/walk.go - About 40 mins to fix

        Function newClassWithEnv has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            name string,
            superClass RubyClass,
            instanceMethods,
            classMethods map[string]RubyMethod,
            builder func(RubyClassObject, ...RubyObject) (RubyObject, error),
        Severity: Minor
        Found in object/class.go - About 35 mins to fix

          Function ParseExprFrom has 5 return statements (exceeds 4 allowed).
          Open

          func ParseExprFrom(fset *gotoken.FileSet, filename string, src interface{}, mode Mode) (ast.Expression, error) {
              if fset == nil {
                  panic("parser.ParseExprFrom: no token.FileSet provided (fset == nil)")
              }
          
          
          Severity: Major
          Found in parser/interface.go - About 35 mins to fix

            Function handleException has 5 return statements (exceeds 4 allowed).
            Open

            func handleException(err error, rescues []*ast.RescueBlock, env object.Environment) (object.RubyObject, error) {
                if err != nil && len(rescues) == 0 {
                    return nil, err
                }
                errorObject := err.(object.RubyObject)
            Severity: Major
            Found in evaluator/evaluator.go - About 35 mins to fix

              Method parser.parseReturnStatement has 5 return statements (exceeds 4 allowed).
              Open

              func (p *parser) parseReturnStatement() *ast.ReturnStatement {
                  if p.trace {
                      defer un(trace(p, "parseReturnStatement"))
                  }
                  stmt := &ast.ReturnStatement{Token: p.curToken}
              Severity: Major
              Found in parser/parser.go - About 35 mins to fix

                Method parser.parseExpression has 5 return statements (exceeds 4 allowed).
                Open

                func (p *parser) parseExpression(precedence int) ast.Expression {
                    if p.trace {
                        defer un(trace(p, "parseExpression"))
                    }
                    prefix := p.prefixParseFns[p.curToken.Type]
                Severity: Major
                Found in parser/parser.go - About 35 mins to fix

                  Function exceptionException has 5 return statements (exceeds 4 allowed).
                  Open

                  func exceptionException(context CallContext, args ...RubyObject) (RubyObject, error) {
                      receiver := context.Receiver()
                      if len(args) == 0 {
                          return receiver, nil
                      }
                  Severity: Major
                  Found in object/exception.go - About 35 mins to fix

                    Function evalArrayIndexExpression has 5 return statements (exceeds 4 allowed).
                    Open

                    func evalArrayIndexExpression(arrayObject *object.Array, index object.RubyObject) object.RubyObject {
                        idx := index.(*object.Integer).Value
                        maxNegative := -int64(len(arrayObject.Elements))
                        maxPositive := maxNegative*-1 - 1
                        if maxPositive < 0 {
                    Severity: Major
                    Found in evaluator/evaluator.go - About 35 mins to fix

                      Function readSource has 5 return statements (exceeds 4 allowed).
                      Open

                      func readSource(filename string, src interface{}) ([]byte, error) {
                          if src != nil {
                              switch s := src.(type) {
                              case string:
                                  return []byte(s), nil
                      Severity: Major
                      Found in parser/interface.go - About 35 mins to fix

                        Method parser.parseParameters has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (p *parser) parseParameters(startToken, endToken token.Type) []*ast.FunctionParameter {
                            if p.trace {
                                defer un(trace(p, "parseParameters"))
                            }
                            hasDelimiters := false
                        Severity: Minor
                        Found in parser/parser.go - About 35 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

                        Function Equal has 5 return statements (exceeds 4 allowed).
                        Open

                        func Equal(a, b Node) bool {
                            if a == b {
                                return true
                            }
                            if reflect.DeepEqual(a, b) {
                        Severity: Major
                        Found in ast/equal.go - About 35 mins to fix

                          Method parser.parseHash has 5 return statements (exceeds 4 allowed).
                          Open

                          func (p *parser) parseHash() ast.Expression {
                              hash := &ast.HashLiteral{Token: p.curToken, Map: make(map[ast.Expression]ast.Expression)}
                              if p.trace {
                                  defer un(trace(p, "parseHash"))
                              }
                          Severity: Major
                          Found in parser/parser.go - About 35 mins to fix

                            Method parser.parseMethodCall has 5 return statements (exceeds 4 allowed).
                            Open

                            func (p *parser) parseMethodCall(context ast.Expression) ast.Expression {
                                if p.trace {
                                    defer un(trace(p, "parseMethodCall"))
                                }
                                contextCallExpression := &ast.ContextCallExpression{Token: p.curToken, Context: context}
                            Severity: Major
                            Found in parser/parser.go - About 35 mins to fix

                              Method parser.parseAssignment has 5 return statements (exceeds 4 allowed).
                              Open

                              func (p *parser) parseAssignment(left ast.Expression) ast.Expression {
                                  if p.trace {
                                      defer un(trace(p, "parseAssignment"))
                                  }
                              
                              
                              Severity: Major
                              Found in parser/parser.go - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language