Showing 86 of 90 total issues
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 parse_afm
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def parse_afm(file_name)
data = {
glyph_widths: {},
bounding_boxes: {},
kern_pairs: {},
- 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 to_string
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.to_string(array)
prefixes = {
bold: '<b>',
italic: '<i>',
underline: '<u>',
Method embed_simple_font
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def embed_simple_font(reference, font, unicode_mapping)
if font_type(font) == :unknown
raise Error, %(Simple font embedding is not uspported for font "#{font.name}.")
end
Method create_gradient_pattern
has 53 lines of code (exceeds 25 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(
Method array_paragraphs
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.array_paragraphs(array)
paragraphs = []
paragraph = []
previous_string = "\n"
scan_pattern = /[^\n]+|\n/
- 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 formatted_text
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def formatted_text(array, options = {})
options = inspect_options_for_text(options.dup)
color = options.delete(:color)
if color
- 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 stroke_axis
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stroke_axis(options = {})
options = {
at: [0, 0],
height: bounds.height - (options[:at] || [0, 0])[1],
width: bounds.width - (options[:at] || [0, 0])[0],
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 parse_gradient_arguments
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_gradient_arguments(
*arguments, from: nil, to: nil, r1: nil, r2: nil, stops: nil,
apply_transformations: nil
)
Method parse_afm
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_afm(file_name)
data = {
glyph_widths: {},
bounding_boxes: {},
kern_pairs: {},
Method soft_mask
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def soft_mask(&block)
renderer.min_version(1.4)
group_attrs = ref!(
Type: :Group,
Method parse_gradient_arguments
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def parse_gradient_arguments(
*arguments, from: nil, to: nil, r1: nil, r2: nil, stops: nil,
apply_transformations: 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 encrypted_pdf_object
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def encrypted_pdf_object(obj, key, id, gen, in_content_stream = false)
case obj
when Array
array_content = obj.map { |e|
encrypted_pdf_object(e, key, id, gen, in_content_stream)
Method initialize
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(data)
super()
data = StringIO.new(data.dup)
data.read(8) # Skip the default header
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 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 add_fragment_to_line
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_fragment_to_line(fragment)
case fragment
when ''
true
when "\n"