Showing 32 of 34 total issues
Method on_multi
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def on_multi(*exps)
result = [:multi]
curr = nil
prev = []
state = :looking
- 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 chain_proc_constructor
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def chain_proc_constructor(name, filter)
raise(ArgumentError, 'Proc or blocks must have arity 0 or 1') if filter.arity > 1
method_name = "FILTER #{name}"
c = Class === self ? self : singleton_class
filter = c.class_eval { define_method(method_name, &filter); instance_method(method_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
Method chain_element
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def chain_element(args, block)
name = args.shift
if Class === name
filter = name
name = filter.name.to_sym
- 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 call
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def call(input)
result = [:multi]
pos = 0
input.scan(ERB_PATTERN) do |token, indicator, code|
text = input[pos...$~.begin(0)]
- 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 on_multi
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def on_multi(*exps)
result = [:multi]
code = nil
exps.each do |exp|
- 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 on_html_attrs
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def on_html_attrs(*attrs)
values = {}
attrs.each do |_, _, name, value|
name = name.to_s
- 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 on_html_tag
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def on_html_tag(name, attrs, content = nil)
return super unless @pretty
name = name.to_s
closed = !content || (empty_exp?(content) && options[:autoclose].include?(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
Method Rule
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def Rule(rule)
case rule
when Rule
rule
when Symbol, Class, true, false, 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
Method on_multi
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def on_multi(*exps)
result = [:multi]
text = nil
exps.each do |exp|
- 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 static?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def static?(code)
return false if code.nil? || code.strip.empty?
return false if syntax_error?(code)
Ripper.lex(code).each do |_, token, str|
- 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 shift_balanced_embexpr
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def shift_balanced_embexpr(tokens)
String.new.tap do |embedded|
embexpr_open = 1
until tokens.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 on_multi
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_multi(*exps)
result = [:multi]
curr = nil
prev = []
state = :looking
Method compile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def compile(level = 0, call_parent = nil)
call_method = method ? (level == 0 ? "#{method}(*exp)" :
"#{method}(*exp[#{level}..-1])") : call_parent
if empty?
raise 'Invalid dispatcher node' unless method
- 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 call
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def call(s)
if options[:encoding] && s.respond_to?(:encoding)
old_enc = s.encoding
s = s.dup if s.frozen?
s.force_encoding(options[:encoding])
- 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 on_html_attrs
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_html_attrs(*attrs)
values = {}
attrs.each do |_, _, name, value|
name = name.to_s
Method on_multi
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def on_multi(*exps)
exps = exps.dup
result = [:multi]
buffer = []
- 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 initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(opts = {})
super
@format = options[:format]
unless [:xhtml, :html, :xml].include?(@format)
if @format == :html4 || @format == :html5
- 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 compile_tokens!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def compile_tokens!(exps, tokens)
beg_str, end_str = strip_quotes!(tokens)
until tokens.empty?
_, type, str = tokens.shift
- 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 call
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(input)
result = [:multi]
pos = 0
input.scan(ERB_PATTERN) do |token, indicator, code|
text = input[pos...$~.begin(0)]
Method Rule
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Rule(rule)
case rule
when Rule
rule
when Symbol, Class, true, false, nil