werein/prestashop

View on GitHub

Showing 29 of 31 total issues

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

      def upload type, resource, id, payload, file
Severity: Minor
Found in lib/prestashop/api/connection.rb - About 35 mins to fix

    Avoid too many return statements within this method.
    Open

              return prepare(node.content.to_s) 
    Severity: Major
    Found in lib/prestashop/api/converter.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return result_hash
      Severity: Major
      Found in lib/prestashop/api/converter.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return result_hash
        Severity: Major
        Found in lib/prestashop/api/converter.rb - About 30 mins to fix

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

                def validate!
                  raise ArgumentError, 'id lang must be number' unless id_lang.kind_of?(Integer)
                  raise ArgumentError, 'name must string' unless name.kind_of?(String)
                  raise ArgumentError, 'group_type must string' unless group_type.kind_of?(String)
                end
          Severity: Minor
          Found in lib/prestashop/mapper/models/product_option.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 reference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def reference
                  if @reference and not @reference.to_s.empty?
                    @reference.to_s.length > 32 ? Digest::MD5.hexdigest(@reference) : @reference
                  else
                    Digest::MD5.hexdigest(name)
          Severity: Minor
          Found in lib/prestashop/mapper/models/product.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 api_url= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def api_url= origin_url
                  url = origin_url.match(/^(http|https):\/\/.*/)
                  url = url.nil? ? 'http://' + origin_url : url.to_s
                  url << '/' unless url.end_with? '/'
                  url << 'api/' unless url.end_with? 'api/'
          Severity: Minor
          Found in lib/prestashop/api/connection.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 create_from_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def create_from_hash resources, id_lang
                    resources = [resources] if resources.kind_of?(Hash)
                    if resources.kind_of?(Array)
                      features = []
                      resources.each do |resource|
          Severity: Minor
          Found in lib/prestashop/mapper/models/product_feature.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 validate! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def validate!
                  raise ArgumentError, 'id lang must be number' unless id_lang.kind_of?(Integer)
                  raise ArgumentError, 'active must be number' unless active.kind_of?(Integer)
                  raise ArgumentError, 'name must string' unless name.kind_of?(String)
                end
          Severity: Minor
          Found in lib/prestashop/mapper/models/manufacturer.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