gooddata/gooddata-ruby

View on GitHub
lib/gooddata/models/metadata.rb

Summary

Maintainability
C
1 day
Test Coverage

Class MdObject has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

  class MdObject < Rest::Resource
    MD_OBJ_CTG = 'obj'
    IDENTIFIERS_CFG = 'instance-identifiers'

    extend Mixin::MdIdToUri
Severity: Minor
Found in lib/gooddata/models/metadata.rb - About 3 hrs to fix

    Method find_replaceable_values has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

          def find_replaceable_values(obj, mapping)
            values_to_replace = GoodData::SmallGoodZilla.extract_element_uri_pairs(MultiJson.dump(obj.to_json))
            values_from_mapping = values_to_replace.select { |i| mapping.map { |a, _| a.uri }.include?(i.first) }
            replaceable_vals = values_from_mapping.map do |a_uri, id|
              from_attribute, to_attribute = mapping.find { |k, _| k.uri == a_uri }
    Severity: Minor
    Found in lib/gooddata/models/metadata.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 save has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def save
          fail('Validation failed') unless validate
    
          opts = {
            :client => client,
    Severity: Minor
    Found in lib/gooddata/models/metadata.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 save has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def save
          fail('Validation failed') unless validate
    
          opts = {
            :client => client,
    Severity: Minor
    Found in lib/gooddata/models/metadata.rb - About 1 hr to fix

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

          def set_flag(flag, value)
            meta['flags'] = [] unless meta['flags']
      
            if (value == '1' || value == 1 || value == true) && !has_flag?(flag)
              meta['flags'].push(flag)
      Severity: Minor
      Found in lib/gooddata/models/metadata.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 replace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def replace(obj, mapping, &block)
              json = mapping.reduce(obj.to_json) do |a, e|
                obj_a, obj_b = e
                uri_what = obj_a.respond_to?(:uri) ? obj_a.uri : obj_a
                uri_for_what = obj_b.respond_to?(:uri) ? obj_b.uri : obj_b
      Severity: Minor
      Found in lib/gooddata/models/metadata.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

      There are no issues that match your filters.

      Category
      Status