prawnpdf/prawn

View on GitHub
lib/prawn/graphics/patterns.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method create_gradient_pattern has 53 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(
Severity: Major
Found in lib/prawn/graphics/patterns.rb - About 2 hrs to fix

    Method parse_gradient_arguments has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def parse_gradient_arguments(
            *arguments, from: nil, to: nil, r1: nil, r2: nil, stops: nil,
            apply_transformations: nil
          )
    
    
    Severity: Minor
    Found in lib/prawn/graphics/patterns.rb - About 1 hr to fix

      Method parse_gradient_arguments has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_gradient_arguments(
              *arguments, from: nil, to: nil, r1: nil, r2: nil, stops: nil,
              apply_transformations: nil
            )
      
      
      Severity: Minor
      Found in lib/prawn/graphics/patterns.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 create_gradient_pattern has a Cognitive Complexity of 8 (exceeds 5 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(
      Severity: Minor
      Found in lib/prawn/graphics/patterns.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 set_gradient has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def set_gradient(type, *grad, **kwargs)
              gradient = parse_gradient_arguments(*grad, **kwargs)
      
              patterns = page.resources[:Pattern] ||= {}
      
      
      Severity: Minor
      Found in lib/prawn/graphics/patterns.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

      There are no issues that match your filters.

      Category
      Status