Showing 71 of 71 total issues
Method apply_font_settings
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def apply_font_settings(fragment = nil, &block)
if fragment.nil?
font = current_format_state[:font]
size = current_format_state[:size]
character_spacing = current_format_state[:character_spacing] ||
- 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 span
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def span(width, options = {})
Prawn.verify_options [:position], options
original_position = y
# FIXME: Any way to move this upstream?
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 image_position
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def image_position(width, height, options)
options[:position] ||= :left
y =
case options[:vposition]
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
) # :nodoc:
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 build_pdf_object
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def build_pdf_object(document)
if compression_method != 0
raise Errors::UnsupportedImageType,
'PNG uses an unsupported compression method'
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
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(document, name, options = {}) # :nodoc:
name ||= options[:family]
unless BUILT_INS.include?(name)
raise Prawn::Errors::UnknownFont,
"#{name} (#{options[:style] || 'normal'}) is not a known 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"
Further reading
Method add_to_transformation_stack
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_to_transformation_stack(a, b, c, d, e, f)
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 font
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def font(name = nil, options = DEFAULT_OPTS)
return((defined?(@font) && @font) || font('Helvetica')) if name.nil?
if state.pages.empty? && !state.page.in_stamp_stream?
raise Prawn::Errors::NotOnPage
- 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 dash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dash(length = nil, options = {})
return current_dash_state if length.nil?
length = Array(length)
- 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 create_gradient_pattern
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_gradient_pattern(gradient)
if gradient.apply_transformations.nil? &&
current_transformation_matrix_with_translation(0, 0) !=
[1, 0, 0, 1, 0, 0]
warn 'Gradients in Prawn 2.x and lower are not correctly positioned '\
- 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 update_last_string
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_last_string(printed, unprinted, normalized_soft_hyphen = nil)
return if printed.nil?
if printed.empty?
@consumed.pop
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {}, &block)
options = options.dup
Prawn.verify_options VALID_OPTIONS, options
- 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 encrypted_pdf_object
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def encrypted_pdf_object(obj, key, id, gen, in_content_stream = false)
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 use_graphic_settings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def use_graphic_settings(override_settings = false)
set_fill_color if current_fill_color != '000000' || override_settings
set_stroke_color if current_stroke_color != '000000' || override_settings
write_line_width if line_width != 1 || override_settings
write_stroke_cap_style if cap_style != :butt || override_settings
- 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"
Further reading
Method set_gradient
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_gradient(type, *grad, **kwargs)
gradient = parse_gradient_arguments(*grad, **kwargs)
patterns = page.resources[:Pattern] ||= {}
- 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 print_line
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def print_line
@nothing_printed = false
printed_fragments = []
fragments_this_line = []
- 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"