paramadeep/poisol

View on GitHub
lib/poisol/stub_mapper/request_matcher.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method matching_hashes? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def matching_hashes?(actuals, expected)
      return false unless actuals.keys.sort == expected.keys.sort
      actuals.each do |key, actual|
        expect = expected[key]

Severity: Minor
Found in lib/poisol/stub_mapper/request_matcher.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

Avoid too many return statements within this method.
Open

      return matching_array? actual_req_body,stub_req_body if actual_req_body.is_a?(Array)
Severity: Major
Found in lib/poisol/stub_mapper/request_matcher.rb - About 30 mins to fix

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

        def matching_array actuals,expected
          return false unless actuals.size == expected.size
          return actuals.sort == expected.sort unless actual[0].is_a(Hash)
          expect = expected.clone
          actuals.each do |actual|
    Severity: Minor
    Found in lib/poisol/stub_mapper/request_matcher.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

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

        def body_matches? actual_req,stub_req
          return true if actual_req.body == stub_req.body
          actual_req_body = load_as_json actual_req.body
          stub_req_body = load_as_json stub_req.body 
          return false unless actual_req_body.class == stub_req_body.class
    Severity: Minor
    Found in lib/poisol/stub_mapper/request_matcher.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