prawnpdf/prawn

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

Summary

Maintainability
B
6 hrs
Test Coverage

Class Fragment has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Fragment
        attr_reader :format_state, :text
        attr_writer :width
        attr_accessor :line_height, :descender, :ascender
        attr_accessor :word_spacing, :left, :baseline
Severity: Minor
Found in lib/prawn/text/formatted/fragment.rb - About 6 hrs to fix

    Method process_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def process_text(text)
              string = strip_zero_width_spaces(text)
    
              if exclude_trailing_white_space?
                string = string.rstrip
    Severity: Minor
    Found in lib/prawn/text/formatted/fragment.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