prawnpdf/prawn

View on GitHub
lib/prawn/text/formatted/arranger.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Arranger has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Arranger #:nodoc:
        attr_reader :max_line_height
        attr_reader :max_descender
        attr_reader :max_ascender
        attr_reader :finalized
Severity: Minor
Found in lib/prawn/text/formatted/arranger.rb - About 2 hrs to fix

    File arranger.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Prawn
      module Text
        module Formatted #:nodoc:
          # @private
    
    
    Severity: Minor
    Found in lib/prawn/text/formatted/arranger.rb - About 2 hrs to fix

      Method apply_font_settings has a Cognitive Complexity of 11 (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] ||
      Severity: Minor
      Found in lib/prawn/text/formatted/arranger.rb - About 1 hr to fix

      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
      Severity: Minor
      Found in lib/prawn/text/formatted/arranger.rb - About 45 mins to fix

      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 omit_trailing_whitespace_from_line_width has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def omit_trailing_whitespace_from_line_width
                @consumed.reverse_each do |hash|
                  if hash[:text] == "\n"
                    break
                  elsif hash[:text].strip.empty? && @consumed.length > 1
      Severity: Minor
      Found in lib/prawn/text/formatted/arranger.rb - About 35 mins to fix

      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 apply_font_size has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def apply_font_size(size, styles)
                if subscript?(styles) || superscript?(styles)
                  relative_size = 0.583
                  size = if size.nil?
                           @document.font_size * relative_size
      Severity: Minor
      Found in lib/prawn/text/formatted/arranger.rb - About 35 mins to fix

      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_style has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def font_style(styles)
                if styles.nil?
                  :normal
                elsif styles.include?(:bold) && styles.include?(:italic)
                  :bold_italic
      Severity: Minor
      Found in lib/prawn/text/formatted/arranger.rb - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status