EGI-FCTF/rOCCI-core

View on GitHub

Showing 15 of 34 total issues

Class Model has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Model
      include Yell::Loggable
      include Helpers::ArgumentValidator
      include Helpers::Renderable

Severity: Minor
Found in lib/occi/core/model.rb - About 4 hrs to fix

    Class Entity has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Entity
          include Yell::Loggable
          include Helpers::Renderable
          include Helpers::Locatable
          include Helpers::InstanceAttributesAccessor
    Severity: Minor
    Found in lib/occi/core/entity.rb - About 3 hrs to fix

      Class Collection has 24 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Collection < Model
            ALL_KEYS = %i[entities action_instances].freeze
            INTERNAL_COLLECTIONS = (ALL_KEYS + [:categories]).freeze
      
            attr_accessor(*ALL_KEYS)
      Severity: Minor
      Found in lib/occi/core/collection.rb - About 2 hrs to fix

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

                  def plain_links!(lines, entity)
                    lines.each do |line|
                      next unless line.start_with?(TextParser::LINK_KEYS.first)
                      logger.debug "Parsing link line #{line.inspect}" if logger_debug?
        
        
        Severity: Minor
        Found in lib/occi/core/parsers/text/entity.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 render_instance_hash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                  def render_instance_hash
                    hsh = {}
        
                    hsh[:kind] = object_kind.to_s
                    %i[mixins actions].each do |symbol|
        Severity: Minor
        Found in lib/occi/core/renderers/json/instance.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 plain has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                    def plain(lines)
                      regexp = Regexp.new(Constants::REGEXP_LOCATION)
        
                      locations = lines.map do |line|
                        next if line.blank?
        Severity: Minor
        Found in lib/occi/core/parsers/text/location.rb - About 45 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 prepare_instance_attribute_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                  def prepare_instance_attribute_value(name, type, value)
                    if ancestor_match?(IP_TYPES, type)
                      value.host? ? "\"#{value}\"" : "\"#{value}/#{value.cidr_mask}\""
                    elsif ancestor_match?(QUOTABLE_TYPES, type)
                      "\"#{value}\""
        Severity: Minor
        Found in lib/occi/core/renderers/text/attributes.rb - About 45 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 add_extended! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                  def add_extended!(hash)
                    hash[:parent] = object_parent.to_s if object_respond_to?(:parent) && object_parent
                    %i[actions depends applies].each do |symbol|
                      next unless object_respond_to?(symbol) && !object_send(symbol).blank?
                      hash[symbol] = object_send(symbol).collect(&:to_s)
        Severity: Minor
        Found in lib/occi/core/renderers/json/category.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 plain_attributes! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                  def plain_attributes!(lines, attributes)
                    lines.each do |line|
                      next unless line.start_with?(TextParser::ATTRIBUTE_KEYS.first)
        
                      name, value = raw_attribute(line)
        Severity: Minor
        Found in lib/occi/core/parsers/text/entity.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 uri_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                    def uri_list(lines)
                      uris = lines.map do |line|
                        next if line.blank? || line.start_with?('#')
                        logger.debug "Parsing location from line #{line.inspect}" if logger_debug?
        
        
        Severity: Minor
        Found in lib/occi/core/parsers/text/location.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 valid_value! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def valid_value!(value)
                if value.nil? && required?
                  raise Occi::Core::Errors::AttributeValidationError,
                        'Value is required but not provided'
                end
        Severity: Minor
        Found in lib/occi/core/attribute_definition.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 set_attributes! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                  def set_attributes!(instance, hash)
                    return if hash.blank?
                    hash.each_pair do |name, value|
                      logger.debug "Setting attribute #{name} to #{value.inspect}" if logger_debug?
                      attribute = instance.attributes[name.to_s]
        Severity: Minor
        Found in lib/occi/core/parsers/json/entity.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 prepare_parent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                  def prepare_parent
                    cand = if object.respond_to?(:directly_related)
                             prepare_kind_rel
                           elsif object.respond_to?(:depends) && object.respond_to?(:applies)
                             prepare_mixin_rel.to_a
        Severity: Minor
        Found in lib/occi/core/renderers/text/category.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 attribute_definitions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                    def attribute_definitions(raw)
                      return {} if raw.blank?
        
                      attr_defs = {}
                      raw.each_pair do |k, v|
        Severity: Minor
        Found in lib/occi/core/parsers/json/category.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_entities! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def validate_entities!(body)
                  found = nil
        
                  %i[link resource entity-collection].each do |type|
                    logger.debug "Attempting to validate #{body.inspect} as #{type}" if logger_debug?
        Severity: Minor
        Found in lib/occi/core/parsers/json_parser.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