paramadeep/poisol

View on GitHub

Showing 9 of 15 total issues

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

Method make_method_to_alter_response_array_object has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def make_method_to_alter_response_array_object
      @response_array_item.each do |field|
        field_name = field[0]
        actual_field_value = field[1]
        is_array = (actual_field_value.class.to_s == "Array")
Severity: Minor
Found in lib/poisol/stub/response/array_response_body.rb - About 1 hr to fix

    Method make_method_to_alter_response_array_object has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_method_to_alter_response_array_object
          @response_array_item.each do |field|
            field_name = field[0]
            actual_field_value = field[1]
            is_array = (actual_field_value.class.to_s == "Array")
    Severity: Minor
    Found in lib/poisol/stub/response/array_response_body.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

    Method generate_method_to_alter_request_array_object has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_method_to_alter_request_array_object
          @request_array_item.each do |field|
            field_name = field[0]
            actual_field_value = field[1]
            is_array = (actual_field_value.class.to_s == "Array")
    Severity: Minor
    Found in lib/poisol/stub/request/request_body_builder.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 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 load_stub_configs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def load_stub_configs
            explolded_configs =  Dir["#{@folder}/**/config.yml"]
            inline_configs = Dir["#{@folder}/**/*.yml"] - ( (explolded_configs.nil?) ?  [] : explolded_configs) - [@domain.file]
            generate_exploded_config explolded_configs unless explolded_configs.nil?
            generate_inline_config inline_configs unless inline_configs.nil?
      Severity: Minor
      Found in lib/poisol/stub_factory.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

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

          def make_method_to_append_response_array
            class_name = self.name.classify.underscore
            method_name = "has_#{class_name}"
            define_method(method_name) do |*input_value|
              assignment_value = input_value.blank? ? 
      Severity: Minor
      Found in lib/poisol/stub/response/array_response_body.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

      Severity
      Category
      Status
      Source
      Language