colinweight/thousand_island

View on GitHub

Showing 5 of 5 total issues

Class Template has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Template
    include ThousandIsland::StyleSheet

    attr_reader :pdf, :pdf_options

Severity: Minor
Found in lib/thousand_island/template.rb - About 3 hrs to fix

    Method draw has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def draw(options={})
    
          @table_options = merged_options(options)
    
          table_options[:header] = prawn_header_setting
    Severity: Minor
    Found in lib/thousand_island/table.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 merge_for_key_and_nested_keys has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def merge_for_key_and_nested_keys(key, keys, *hashes)
            temp = {}
            merged = {}
            hashes.each do |h|
              keys.each do |k|
    Severity: Minor
    Found in lib/thousand_island/utilities/utilities.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 draw_footer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def draw_footer(&block)
          footer_obj.draw do
            yield if block_given?
            footer_content &block if respond_to? :footer_content
          end if render_footer?
    Severity: Minor
    Found in lib/thousand_island/template.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 draw_header has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def draw_header
          header_obj.draw do
            header_content if respond_to? :header_content
            yield if block_given?
          end if render_header?
    Severity: Minor
    Found in lib/thousand_island/template.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

    Severity
    Category
    Status
    Source
    Language