ePages-de/epages-rest-ruby

View on GitHub

Showing 4 of 7 total issues

Method parse_legal_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_legal_info(data)
        {
          contact_info: Epages::ContentPageSummary.new(data[:contactInformation].nil? ? {'':''} : data[:contactInformation]),
          privacy_policy: Epages::ContentPageSummary.new(data[:privacyPolicy].nil? ? {'':''} : data[:privacyPolicy]),
          terms_and_conditions: Epages::ContentPageSummary.new(data[:termsAndConditions].nil? ? {'':''} : data[:termsAndConditions]),
Severity: Minor
Found in lib/epages/rest/utils.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 perform_request_with_key_and_objects has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def perform_request_with_key_and_objects(request_method, path, options, key, klass)
Severity: Minor
Found in lib/epages/rest/utils.rb - About 35 mins to fix

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

          def parallel_calls(requests)
            threads = []
            result = requests
            requests.each do |key, values|
              values.each_with_index do |call, i|
    Severity: Minor
    Found in lib/epages/rest/shop.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 parse_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_attributes(data, klass = nil)
          data.keys.each do |key|
            next if data[key.to_sym].nil?
            value = klass.nil? ? data[key.to_sym] : klass.new(data[key.to_sym])
            instance_variable_set("@#{key.to_s.underscore}", value)
    Severity: Minor
    Found in lib/epages/utils.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