File box.rb
has 409 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Prawn
module Text
module Formatted
# Formatted text box.
#
Class Box
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Box
include Prawn::Text::Formatted::Wrap
# @group Experimental API
Method render
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def render(flags = {})
unprinted_text = []
@document.save_font do
@document.character_spacing(@character_spacing) do
- 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 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(formatted_text, options = {})
@inked = false
Prawn.verify_options(valid_options, options)
options = options.dup
Method draw_fragment
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def draw_fragment(
fragment, accumulated_width = 0, line_width = 0, word_spacing = 0
)
case @align
when :left
Method shrink_to_fit
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def shrink_to_fit(text)
loop do
if @disable_wrap_by_char && @font_size > @min_font_size
begin
wrap(text)
- 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 font_style
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def font_style(styles)
if styles
if styles.include?(:bold)
styles.include?(:italic) ? :bold_italic : :bold
elsif styles.include?(:italic)
- 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 analyze_glyphs_for_fallback_font_support
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def analyze_glyphs_for_fallback_font_support(hash)
font_glyph_pairs = []
original_font = @document.font.family
fragment_font = hash[:font] || original_font
Method draw_fragment
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def draw_fragment(
fragment, accumulated_width = 0, line_width = 0, word_spacing = 0
)
case @align
when :left
- 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 form_fragments_from_like_font_glyph_pairs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def form_fragments_from_like_font_glyph_pairs(font_glyph_pairs, hash)
fragments = []
fragment = nil
current_font = 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(formatted_text, options = {})
@inked = false
Prawn.verify_options(valid_options, options)
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 analyze_glyphs_for_fallback_font_support
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def analyze_glyphs_for_fallback_font_support(hash)
font_glyph_pairs = []
original_font = @document.font.family
fragment_font = hash[:font] || original_font
- 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"