apimatic/core-lib-ruby

View on GitHub
lib/apimatic-core/utilities/comparison_helper.rb

Summary

Maintainability
C
1 day
Test Coverage
A
100%

Method match_body has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    def self.match_body(expected_body,
                        actual_body,
                        check_values: false,
                        check_order: false,
                        check_count: false)
Severity: Minor
Found in lib/apimatic-core/utilities/comparison_helper.rb - About 7 hrs 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 match_headers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def self.match_headers(expected_headers,
                           actual_headers,
                           allow_extra: true)
      return false if ((actual_headers.length < expected_headers.length) ||
        ((allow_extra == false) && (actual_headers.length > expected_headers.length)))
Severity: Minor
Found in lib/apimatic-core/utilities/comparison_helper.rb - About 55 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

Avoid deeply nested control flow statements.
Open

              return false if (i != 0 && matches.map{|x| previous_matches.map{|y| y > x}.all?}.all?)
Severity: Major
Found in lib/apimatic-core/utilities/comparison_helper.rb - About 45 mins to fix

    There are no issues that match your filters.

    Category
    Status