Showing 18 of 29 total issues
File racc_parser.rb
has 678 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'racc/parser.rb'
# racc_parser.rb : generated by racc
module Cadenza
Method state=
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def state=(new_state)
# if trying to transition to a new state raise an exception
raise IllegalStateError, new_state unless VALID_STATES.include?(new_state)
# no special transition for the same state
- 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 scan_statement
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def scan_statement
# eat any whitespace at the start of the string
whitespace = @scanner.scan_until(/\S/)
if whitespace
- 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 scan_statement
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scan_statement
# eat any whitespace at the start of the string
whitespace = @scanner.scan_until(/\S/)
if whitespace
Method scan_body
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def scan_body
if (text = @scanner.scan(/\{\{/))
@context = :statement
token(:VAR_OPEN, text)
- 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 eval
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def eval(context)
l = @left.eval(context)
r = @right.eval(context)
case @operator
Method render_operation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_operation(node, context, blocks)
self.state = :var unless state == :tag
# calculate the operator precedence of the left, right and parent node
node_precedence = calculate_precedence(node)
- 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 render_filtered_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_filtered_value(node, context, blocks)
state == :var unless state == :tag
render(node.value, context, blocks)
- 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
Avoid too many return
statements within this method. Open
return l && r
Avoid too many return
statements within this method. Open
return l / r
Avoid too many return
statements within this method. Open
return l - r
Avoid too many return
statements within this method. Open
return l > r
Avoid too many return
statements within this method. Open
return l + r
Avoid too many return
statements within this method. Open
return l < r
Avoid too many return
statements within this method. Open
return l * r
Avoid too many return
statements within this method. Open
return l || r
Method render_children
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def render_children(nodes, context, blocks)
nodes.each_with_index do |node, idx|
is_last_loop = idx == nodes.length - 1
output << ("\u2503 " * @level)
- 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 lookup_on_object
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.lookup_on_object(identifier, object)
sym_identifier = identifier.to_sym
# allow looking up array indexes with dot notation, example: alphabet.0 => "a"
return object[identifier.to_i] if object.respond_to?(:[]) && object.is_a?(Array) && identifier =~ /\A\d+\z/
- 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"