Showing 36 of 60 total issues
Function Eval
has a Cognitive Complexity of 172 (exceeds 20 allowed). Consider refactoring. Open
func Eval(node ast.Node, env object.Environment) (object.RubyObject, error) {
switch node := node.(type) {
// Statements
case *ast.Program:
- 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
File parser.go
has 1337 lines of code (exceeds 500 allowed). Consider refactoring. Open
package parser
import (
"fmt"
gotoken "go/token"
Function Eval
has 369 lines of code (exceeds 50 allowed). Consider refactoring. Open
func Eval(node ast.Node, env object.Environment) (object.RubyObject, error) {
switch node := node.(type) {
// Statements
case *ast.Program:
parser
has 66 methods (exceeds 20 allowed). Consider refactoring. Open
type parser struct {
file *gotoken.File
l *lexer.Lexer
errors []error
File ast.go
has 762 lines of code (exceeds 500 allowed). Consider refactoring. Open
package ast
import (
"bytes"
"fmt"
Function Walk
has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring. Open
func Walk(v Visitor, node Node) {
if v = v.Visit(node); v == nil {
return
}
- 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
Function startLexer
has 193 lines of code (exceeds 50 allowed). Consider refactoring. Open
func startLexer(l *Lexer) StateFn {
r := l.next()
if isWhitespace(r) {
l.ignore()
return startLexer
File evaluator.go
has 665 lines of code (exceeds 500 allowed). Consider refactoring. Open
package evaluator
import (
"fmt"
"sort"
Function Eval
has 62 return statements (exceeds 4 allowed). Open
func Eval(node ast.Node, env object.Environment) (object.RubyObject, error) {
switch node := node.(type) {
// Statements
case *ast.Program:
Function startLexer
has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring. Open
func startLexer(l *Lexer) StateFn {
r := l.next()
if isWhitespace(r) {
l.ignore()
return startLexer
- 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
Function startLexer
has 46 return statements (exceeds 4 allowed). Open
func startLexer(l *Lexer) StateFn {
r := l.next()
if isWhitespace(r) {
l.ignore()
return startLexer
Function Walk
has 117 lines of code (exceeds 50 allowed). Consider refactoring. Open
func Walk(v Visitor, node Node) {
if v = v.Visit(node); v == nil {
return
}
Method parser.parseFunctionLiteral
has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring. Open
func (p *parser) parseFunctionLiteral() ast.Expression {
if p.trace {
defer un(trace(p, "parseFunctionLiteral"))
}
lit := &ast.FunctionLiteral{Token: p.curToken}
- 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 parser.init
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *parser) init(fset *gotoken.FileSet, filename string, src []byte, mode Mode) {
p.file = fset.AddFile(filename, -1, len(src))
p.l = lexer.New(string(src))
p.errors = []error{}
Method parser.parseFunctionLiteral
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *parser) parseFunctionLiteral() ast.Expression {
if p.trace {
defer un(trace(p, "parseFunctionLiteral"))
}
lit := &ast.FunctionLiteral{Token: p.curToken}
Method parser.parseParameters
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *parser) parseParameters(startToken, endToken token.Type) []*ast.FunctionParameter {
if p.trace {
defer un(trace(p, "parseParameters"))
}
hasDelimiters := false
Function kernelRequire
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func kernelRequire(context CallContext, args ...RubyObject) (RubyObject, error) {
if len(args) != 1 {
return nil, NewWrongNumberOfArgumentsError(1, len(args))
}
name, ok := args[0].(*String)
Method parser.parseFunctionLiteral
has 8 return statements (exceeds 4 allowed). Open
func (p *parser) parseFunctionLiteral() ast.Expression {
if p.trace {
defer un(trace(p, "parseFunctionLiteral"))
}
lit := &ast.FunctionLiteral{Token: p.curToken}
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)
Function fileExpandPath
has 7 return statements (exceeds 4 allowed). Open
func fileExpandPath(context CallContext, args ...RubyObject) (RubyObject, error) {
switch len(args) {
case 1:
str, ok := args[0].(*String)
if !ok {