robertgauld/gandi_v5

View on GitHub

Showing 21 of 21 total issues

Class Domain has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Domain
    include GandiV5::Data

    SERVICES = {
      gandidns: 'GandiDNS',
Severity: Minor
Found in lib/gandi_v5/domain.rb - About 4 hrs to fix

    Class Domain has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Domain
          include GandiV5::Data
    
          members :fqdn, :automatic_snapshots
    
    
    Severity: Minor
    Found in lib/gandi_v5/live_dns/domain.rb - About 3 hrs to fix

      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 paginated_get has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def paginated_get(url, page = (1..), per_page = 100, **headers)
              unless page.respond_to?(:each)
                fail ArgumentError, 'page must be positive' unless page.positive?
        
                page = [page]
        Severity: Minor
        Found in lib/gandi_v5.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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.create(fqdn, dry_run: false, sharing_id: nil, **params)
              fail ArgumentError, 'missing keyword: owner' unless params.key?(:owner)
        
              body = params.merge(fqdn: fqdn)
                           .transform_values { |val| val.respond_to?(:to_gandi) ? val.to_gandi : val }
        Severity: Minor
        Found in lib/gandi_v5/domain.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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.create(fqdn, dry_run: false, sharing_id: nil, **params)
                fail ArgumentError, 'missing keyword: owner' unless params.key?(:owner)
        
                body = params.merge(fqdn: fqdn)
                             .transform_values { |val| val.respond_to?(:to_gandi) ? val.to_gandi : val }
        Severity: Minor
        Found in lib/gandi_v5/domain/transfer_in.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 patch_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def patch_type(new_type, sharing_id, dry_run)
                fail ArgumentError unless TYPES.include?(new_type)
                return false if type == new_type
        
                url_ = "#{url}/type"
        Severity: Minor
        Found in lib/gandi_v5/email/mailbox.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 replace_records has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def replace_records(records, name: nil, type: nil)
                if type
                  GandiV5::LiveDNS.require_valid_record_type(type) if type
                  fail ArgumentError, 'missing keyword: name' if name.nil?
                end
        Severity: Minor
        Found in lib/gandi_v5/live_dns/domain.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 list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.list(page: (1..), per_page: 100, sharing_id: nil)
                page = [page.to_i] unless page.respond_to?(:each)
                params = { per_page: per_page }
                params[:sharing_id] = sharing_id unless sharing_id.nil?
        
        
        Severity: Minor
        Found in lib/gandi_v5/live_dns/domain.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 update_contacts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_contacts(admin: nil, bill: nil, tech: nil)
              body = {
                admin: admin.respond_to?(:to_gandi) ? admin.to_gandi : admin,
                bill: bill.respond_to?(:to_gandi) ? bill.to_gandi : bill,
                tech: tech.respond_to?(:to_gandi) ? tech.to_gandi : tech
        Severity: Minor
        Found in lib/gandi_v5/domain.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_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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def update(target: nil, protocol: nil, type: nil, override: nil)
                body = {}
                body['url'] = target.to_s unless target.nil?
                body['protocol'] = protocol.to_s.delete('_') unless protocol.nil?
                body['type'] = type.to_s unless type.nil?
        Severity: Minor
        Found in lib/gandi_v5/domain/web_forwarding.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.create(fqdn, login, password, aliases: [], type: :standard, dry_run: false)
                fail ArgumentError, "#{type.inspect} is not a valid type" unless TYPES.include?(type)
                if GandiV5::Email::Slot.list.none? { |slot| slot.mailbox_type == type && slot.inactive? }
                  fail GandiV5::Error, "no available #{type} slots"
                end
        Severity: Minor
        Found in lib/gandi_v5/email/mailbox.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def update(**body)
                return 'Nothing to update.' if body.empty?
        
                check_password body[:password] if body.key?(:password)
        
        
        Severity: Minor
        Found in lib/gandi_v5/email/mailbox.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 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 gandify_web_forwardings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.gandify_web_forwardings(value)
              type_map = {
                'permanent' => 'http301',
                'temporary' => 'http302',
                'found' => 'http302'
        Severity: Minor
        Found in lib/gandi_v5/template.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

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

            def update(
              name: nil,
              description: nil,
              dns_records: nil,
              mailboxes: nil,
        Severity: Minor
        Found in lib/gandi_v5/template.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.create(name:, description:, sharing_id: nil, **payload)
              if payload.key? :dns_records
                payload['dns:records'] = gandify_dns_records(payload.delete(:dns_records))
              end
              if payload.key? :mailboxes
        Severity: Minor
        Found in lib/gandi_v5/template.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