Showing 71 of 71 total issues
Method array_from_tokens
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def self.array_from_tokens(tokens)
array = []
styles = []
colors = []
link = 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
File box.rb
has 412 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Prawn
module Text
module Formatted
# @group Stable API
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
Class Box
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Box
include Prawn::Text::Formatted::Wrap
# @group Experimental API
Method array_from_tokens
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.array_from_tokens(tokens)
array = []
styles = []
colors = []
link = nil
Class BoundingBox
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class BoundingBox
class NoReferenceBounds < StandardError
def initialize(message = "Can't find reference bounds: my parent is unset")
super
end
Method to_string
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def self.to_string(array)
prefixes = {
bold: '<b>',
italic: '<i>',
underline: '<u>',
- 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
Class LineWrap
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class LineWrap # :nodoc:
# The width of the last wrapped line
#
def width
@accumulated_width || 0
File document.rb
has 307 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 build_pdf_object
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_pdf_object(document)
if compression_method != 0
raise Errors::UnsupportedImageType,
'PNG uses an unsupported compression method'
end
Method number_pages
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def number_pages(string, options = {})
opts = options.dup
start_count_at = opts.delete(:start_count_at).to_i
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
File arranger.rb
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Prawn
module Text
module Formatted # :nodoc:
# @private
Class Arranger
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Arranger # :nodoc:
class NotFinalized < StandardError
DEFAULT_MESSAGE = 'Lines must be finalized'
MESSAGE_WITH_METHOD = 'Lines must be finalized before calling #%<method>s'
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 add_fragment_to_line
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def add_fragment_to_line(fragment)
case fragment
when ''
true
when "\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 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 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.to_string(array)
prefixes = {
bold: '<b>',
italic: '<i>',
underline: '<u>',
Method create_gradient_pattern
has 51 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 'Gradients in Prawn 2.x and lower are not correctly positioned '\
Method parse_afm
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_afm(file_name)
data = {
glyph_widths: {},
bounding_boxes: {},
kern_pairs: {},
Method array_paragraphs
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.array_paragraphs(array) # :nodoc:
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"