Showing 86 of 90 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
Class Fragment
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
class Fragment
attr_reader :format_state
attr_reader :text
attr_writer :width
attr_accessor :line_height
File box.rb
has 409 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Prawn
module Text
module Formatted
# Formatted text box.
#
File ttf.rb
has 400 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'ttfunk'
require 'ttfunk/subset_collection'
require_relative 'to_unicode_cmap'
module Prawn
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 TTF
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class TTF < Font
# TrueType font error.
class Error < StandardError
# @private
DEFAULT_MESSAGE = 'TTF font error'
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
# Indicates absence of a reference bounding box of a fixed height.
class NoReferenceBounds < StandardError
def initialize(message = "Can't find reference bounds: my parent is unset")
super
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
# The width of the last wrapped line.
#
# @return [Number]
def width
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 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 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 encode_text
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def encode_text(text, options = {})
text = text.chomp
if options[:kerning]
last_subset = 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 generate
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate
chunks = []
# Header
chunks << <<~HEADER.chomp
File arranger.rb
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Prawn
module Text
module Formatted
# D data structure for 2-stage processing of lines of formatted text.
# @private
Method embed_composite_font
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def embed_composite_font(reference, font)
if font_type(font) == :unknown
raise Error, %(Composite font embedding is not uspported for font "#{font.name}.")
end
Class Arranger
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Arranger
# You're getting this because you're trying to get some information from
# the arranger before it finished processing text.
class NotFinalized < StandardError
# @private
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"