Showing 94 of 94 total issues
File default.rb
has 1648 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Parser
##
# Default AST builder. Uses {AST::Node}s.
#
Class Default
has 198 methods (exceeds 20 allowed). Consider refactoring. Open
class Builders::Default
class << self
##
# AST compatibility attribute; since `-> {}` is not semantically
# equivalent to `lambda {}`, all new code should set this attribute
Method process
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def process(node)
if node
p node
source_line_no = nil
- 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
Class Rewriter
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Rewriter
attr_reader :source_buffer
attr_reader :diagnostics
##
Method append
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def append(action)
range = action.range
# Is this an insertion?
if range.empty?
- 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 setup_option_parsing
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_option_parsing(opts)
opts.banner = "Usage: #{runner_name} [options] FILE|DIRECTORY..."
opts.on_tail '-h', '--help', 'Display this help message and exit' do
puts opts.help
Class Range
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Range
include Comparable
attr_reader :source_buffer
attr_reader :begin_pos, :end_pos
Method check_condition
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def check_condition(cond)
case cond.type
when :masgn
if @parser.version <= 23
diagnostic :error, :masgn_as_condition, nil, cond.loc.expression
- 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 accessible
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def accessible(node)
case node.type
when :__FILE__
if @emit_file_line_as_literals
n(:str, [ node.loc.expression.source_buffer.name ],
- 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
Class TreeRewriter
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class TreeRewriter
attr_reader :source_buffer
attr_reader :diagnostics
##
Class Literal
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Lexer::Literal
DELIMITERS = { '(' => ')', '[' => ']', '{' => '}', '<' => '>' }
SPACE = ' '.ord
TAB = "\t".ord
Method process
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process(node)
if node
p node
source_line_no = nil
Class StaticEnvironment
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class StaticEnvironment
FORWARD_ARGS = :FORWARD_ARGS
ANONYMOUS_RESTARG_IN_CURRENT_SCOPE = :ANONYMOUS_RESTARG_IN_CURRENT_SCOPE
ANONYMOUS_RESTARG_INHERITED = :ANONYMOUS_RESTARG_INHERITED
Class Buffer
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Buffer
attr_reader :name, :first_line
##
# @api private
File rewriter.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Parser
module Source
##
# {Rewriter} is deprecated. Use {TreeRewriter} instead.
Method dedent
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def dedent(string)
original_encoding = string.encoding
# Prevent the following error when processing binary encoded source.
# "\xC0".split # => ArgumentError (invalid byte sequence in UTF-8)
lines = string.force_encoding(Encoding::BINARY).split("\\\n")
- 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 accessible
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def accessible(node)
case node.type
when :__FILE__
if @emit_file_line_as_literals
n(:str, [ node.loc.expression.source_buffer.name ],
Method associate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def associate(begin_t, pairs, end_t)
key_set = Set.new
pairs.each do |pair|
next unless pair.type.eql?(:pair)
- 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 nest_and_try_closing
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def nest_and_try_closing(delimiter, ts, te, lookahead=nil)
delimiter = coerce_encoding(delimiter)
if @start_delim && @start_delim == delimiter
@nesting += 1
- 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 dedent_string
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def dedent_string(node, dedent_level)
if !dedent_level.nil?
dedenter = Lexer::Dedenter.new(dedent_level)
case node.type
- 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"