maestrano/mno-enterprise

View on GitHub
core/lib/mno_enterprise/testing_support/mnoe_faraday_test_adapter.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Consider simplifying this complex logical expression.
Open

        if src[key] && dst[key] && src[key].is_a?(Hash) && dst[key].is_a?(Hash)
          params_deep_equal?(src[key],dst[key])
        else
          (src[key] == '**' && dst[key]) || src[key] == dst[key]
        end
Severity: Major
Found in core/lib/mno_enterprise/testing_support/mnoe_faraday_test_adapter.rb - About 40 mins to fix

    Method new_stub has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def new_stub(request_method, path, headers = {}, body=nil, &block)
    Severity: Minor
    Found in core/lib/mno_enterprise/testing_support/mnoe_faraday_test_adapter.rb - About 35 mins to fix

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

          def params_deep_equal?(src,dst)
            src.keys.all? do |key|
              if src[key] && dst[key] && src[key].is_a?(Hash) && dst[key].is_a?(Hash)
                params_deep_equal?(src[key],dst[key])
              else
      Severity: Minor
      Found in core/lib/mno_enterprise/testing_support/mnoe_faraday_test_adapter.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def call(env)
          super
          normalized_path = Faraday::Utils.normalize_path(env[:url])
          params_encoder = env.request.params_encoder || Faraday::Utils.default_params_encoder
      
      
      Severity: Minor
      Found in core/lib/mno_enterprise/testing_support/mnoe_faraday_test_adapter.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