robertgauld/gandi_v5

View on GitHub
lib/gandi_v5/domain.rb

Summary

Maintainability
C
7 hrs
Test Coverage
A
99%

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

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

        def renew_for(duration = 1, sharing_id: nil, dry_run: false)
          body = { duration: duration }.to_json
          url_ = url('renew')
          url_ = sharing_id ? "#{url_}?sharing_id=#{sharing_id}" : url_
    
    
    Severity: Minor
    Found in lib/gandi_v5/domain.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