Showing 86 of 90 total issues
Method recurse_bounding_box
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def recurse_bounding_box(max_depth = 4, depth = 1)
width = (bounds.width - 15) / 2
height = (bounds.height - 15) / 2
left_top_corners = combine([5, bounds.right - width - 5], [bounds.top - 5, height + 5])
left_top_corners.each do |lt|
- 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 add_subsection_to
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_subsection_to(title, position = :last, &block)
@parent = items[title]
unless @parent
raise Prawn::Errors::UnknownOutlineTitle,
"\n No outline item with title: '#{title}' exists in the outline tree"
- 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 text
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def text(string, options = {})
return false if string.nil?
# we modify the options. don't change the user's hash
options = options.dup
- 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 verify_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify_options(accepted, actual)
return unless debug || $DEBUG
unless (act = Set[*actual.keys]).subset?(acc = Set[*accepted])
raise Prawn::Errors::UnknownOption,
- 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 color_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def color_type(color)
case color
when String
if /\A\h{6}\z/.match?(color)
:RGB
- 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 process_text
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_text(text)
string = strip_zero_width_spaces(text)
if exclude_trailing_white_space?
string = string.rstrip
- 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"