Class Document
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Document
include Prawn::Document::Internals
include PDF::Core::Annotations
include PDF::Core::Destinations
include Prawn::Document::Security
File document.rb
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'stringio'
require_relative 'document/bounding_box'
require_relative 'document/column_box'
require_relative 'document/internals'
Method number_pages
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def number_pages(string, options = {})
opts = options.dup
start_count_at = opts.delete(:start_count_at)
page_filter =
- 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 start_new_page
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_new_page(options = {})
last_page = state.page
if last_page
last_page_size = last_page.size
last_page_layout = last_page.layout
Method number_pages
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def number_pages(string, options = {})
opts = options.dup
start_count_at = opts.delete(:start_count_at)
page_filter =
Method start_new_page
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def start_new_page(options = {})
last_page = state.page
if last_page
last_page_size = last_page.size
last_page_layout = last_page.layout
- 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 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"