app/helpers/washout_builder_method_list_helper.rb
Method create_return_type_list_html
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def create_return_type_list_html(xml, output)
if output.nil? || output[0].blank?
xml.span('class' => 'pre') { |sp| sp << 'void' }
else
complex_class = output[0].find_complex_class_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
Unnecessary spacing detected. Open
Open
return_content = builder_out[0].multiplied ? "Array of #{real_class}" : "#{real_class}"
- Read upRead up
- Exclude checks
This cop checks for extra/unnecessary whitespace.
Example:
# good if AllowForAlignment is true
name = "RuboCop"
# Some comment and an empty line
website += "/bbatsov/rubocop" unless cond
puts "rubocop" if debug
# bad for any configuration
set_app("RuboCop")
website = "https://github.com/bbatsov/rubocop"
Prefer to_s
over string interpolation. Open
Open
sp << "#{output[0].type}"
- Read upRead up
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Operator ?
should be surrounded by a single space. Open
Open
return_content = builder_out[0].multiplied ? "Array of #{real_class}" : "#{real_class}"
- Read upRead up
- Exclude checks
Checks that operators have space around them, except for ** which should not have surrounding space.
Example:
# bad
total = 3*4
"apple"+"juice"
my_number = 38/4
a ** b
# good
total = 3 * 4
"apple" + "juice"
my_number = 38 / 4
a**b
Prefer to_s
over string interpolation. Open
Open
y << "#{return_content}"
- Read upRead up
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Prefer to_s
over string interpolation. Open
Open
return_content = builder_out[0].multiplied ? "Array of #{real_class}" : "#{real_class}"
- Read upRead up
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var