paramadeep/poisol

View on GitHub

Showing 15 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 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

    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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def generate_methods_to_alter_request_object
          request_body = @stub_config.request.body.clone
          request_body.each do |field|
            field_name = field[0]
            actual_field_value = field[1]
    Severity: Minor
    Found in lib/poisol/stub/request/request_body_builder.rb and 1 other location - About 35 mins to fix
    lib/poisol/stub/response/response_body_builder.rb on lines 13..22

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def make_methods_to_alter_response_object
          response_body = @stub_config.response.body.clone
          response_body.each do |field|
            field_name = field[0]
            actual_field_value = field[1]
    Severity: Minor
    Found in lib/poisol/stub/response/response_body_builder.rb and 1 other location - About 35 mins to fix
    lib/poisol/stub/request/request_body_builder.rb on lines 63..72

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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 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 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def generate_exploded_config explolded_configs
            explolded_configs.each do |config_file|
              PoisolLog.info "Processing #{config_file}"
              dynamic_name = (FileName.get_dir_name config_file).camelize
              config = StubConfigBuilder.new.is_exploded.with_file(config_file).with_domain(@domain.full_url).build
      Severity: Minor
      Found in lib/poisol/stub_factory.rb and 1 other location - About 25 mins to fix
      lib/poisol/stub_factory.rb on lines 35..40

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 30.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def generate_inline_config inline_configs
            inline_configs.each do |config_file|
              PoisolLog.debug "Processing #{config_file}"
              dynamic_name = (FileName.get_file_name config_file).camelize
              stub_config = StubConfigBuilder.new.is_inline.with_file(config_file).with_domain(@domain.full_url).build
      Severity: Minor
      Found in lib/poisol/stub_factory.rb and 1 other location - About 25 mins to fix
      lib/poisol/stub_factory.rb on lines 26..31

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 30.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def make_method_to_alter_response_field field_name,actual_field_value
            method_name = "has_#{field_name.underscore}"
            define_method(method_name) do |*input_value|
              input_value = input_value[0]
              assignment_value = get_assignment_value actual_field_value,input_value
      Severity: Minor
      Found in lib/poisol/stub/response/response_body_builder.rb and 1 other location - About 15 mins to fix
      lib/poisol/stub/request/request_body_builder.rb on lines 102..108

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 26.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def generate_method_to_alter_request_field field_name,actual_field_value
            method_name = "by_#{field_name.underscore}"
            define_method(method_name) do |*input_value|
              input_value = input_value[0]
              assignment_value = get_assignment_value actual_field_value,input_value
      Severity: Minor
      Found in lib/poisol/stub/request/request_body_builder.rb and 1 other location - About 15 mins to fix
      lib/poisol/stub/response/response_body_builder.rb on lines 58..64

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 26.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language