robertgauld/gandi_v5

View on GitHub
lib/gandi_v5/data.rb

Summary

Maintainability
B
5 hrs
Test Coverage
A
100%

Class GandiV5 has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

class GandiV5
  # Addin providing a DSL to manage declaring attributes and how to map
  # and convert to/from Gandi's fields.
  # @api private
  module Data
Severity: Minor
Found in lib/gandi_v5/data.rb - About 2 hrs to fix

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

        def to_h_transform_enumerable(value)
          method = :transform_keys if value.respond_to?(:transform_keys)
          method ||= :map if value.respond_to?(:map)
    
          value.send(method) do |v|
    Severity: Minor
    Found in lib/gandi_v5/data.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 to_h has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_h
          data_members.to_h do |key|
            value = send(key)
            next [key, value] if value.nil?
    
    
    Severity: Minor
    Found in lib/gandi_v5/data.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 values_at has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def values_at(*keys)
          keys.map(&:to_s).map do |key|
            key, sub_key = key.split('.', 2)
            unless data_member?(key.to_sym)
              fail ArgumentError, "#{key} is not a member."
    Severity: Minor
    Found in lib/gandi_v5/data.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 translate_gandi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def translate_gandi(data)
            return nil unless data.is_a?(Hash)
    
            data = data.clone
    
    
    Severity: Minor
    Found in lib/gandi_v5/data.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