Showing 29 of 29 total issues
Avoid deeply nested control flow statements. Open
switch ( _parser_actions[_acts++] )
{
case 0:
// line 4 "JavaScanner.rl"
{ mark_pfx = p; }
Method numeric_specificity
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def numeric_specificity(tag_name, nesting_parts)
nesting_parts = nesting_parts.dup
name_parts = tag_name.split(':')
specificity = 0
value = 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 validate_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_params(name, options, &block)
unless options.has_key? :for
raise ArgumentError.new("tag definition must contain a :for option or a block") unless block
raise ArgumentError.new("tag definition must contain a :for option when used with the :expose option") unless options[:expose].empty?
end
- 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 deeply nested control flow statements. Open
if ( data[p] < _parser_trans_keys[_mid] )
_upper = _mid - 2;
else if ( data[p] > _parser_trans_keys[_mid+1] )
_lower = _mid + 2;
else {
Avoid deeply nested control flow statements. Open
if ( _upper < _lower )
break;
Avoid deeply nested control flow statements. Open
if ( data[p] < _parser_trans_keys[_mid] )
_upper = _mid - 1;
else if ( data[p] > _parser_trans_keys[_mid] )
_lower = _mid + 1;
else {
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(context, locals, name, attributes, block)
Method render_tag
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_tag(name, attributes = {}, &block)
if name =~ /^(.+?):(.+)$/
render_tag($1) { render_tag($2, attributes, &block) }
else
tag_definition_block = @definitions[qualified_tag_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 qualified_tag_name
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def qualified_tag_name(name)
nesting_parts = @tag_binding_stack.collect { |tag| tag.name }
nesting_parts << name unless nesting_parts.last == name
specific_name = nesting_parts.join(':') # specific_name always has the highest specificity
unless @definitions.has_key? specific_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"