kigster/dnsmadeeasy

View on GitHub
lib/dnsmadeeasy/api/client.rb

Summary

Maintainability
D
1 day
Test Coverage

Class Client has 51 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Client
      class << self
        def public_operations
          (new('a', 'b').methods - Object.methods).map(&:to_s).reject { |r| r =~ /[=]$|^(api_|on_|request)/ }.sort
        end
Severity: Major
Found in lib/dnsmadeeasy/api/client.rb - About 7 hrs to fix

    File client.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'time'
    require 'openssl'
    require 'json'
    require 'uri'
    require 'net/http'
    Severity: Minor
    Found in lib/dnsmadeeasy/api/client.rb - About 2 hrs to fix

      Method create_httpred_record has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def create_httpred_record(domain_name, name, value, redirectType = 'STANDARD - 302', description = '', keywords = '', title = '', options = {})
      Severity: Major
      Found in lib/dnsmadeeasy/api/client.rb - About 1 hr to fix

        Method create_srv_record has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def create_srv_record(domain_name, name, priority, weight, port, value, options = {})
        Severity: Major
        Found in lib/dnsmadeeasy/api/client.rb - About 50 mins to fix

          Method update_record has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def update_record(domain, record_id, name, type, value, options = {})
          Severity: Minor
          Found in lib/dnsmadeeasy/api/client.rb - About 45 mins to fix

            Method create_record has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def create_record(domain_name, name, type, value, options = {})
            Severity: Minor
            Found in lib/dnsmadeeasy/api/client.rb - About 35 mins to fix

              Method create_mx_record has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def create_mx_record(domain_name, name, priority, value, options = {})
              Severity: Minor
              Found in lib/dnsmadeeasy/api/client.rb - About 35 mins to fix

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

                      def process_response!(response)
                        response.value # raise Net::HTTPServerException unless response was 2xx
                        process_rate_limits(response)
                        unparsed_json = response.body.to_s.empty? ? '{}' : response.body
                        Hashie::Mash.new(JSON.parse(unparsed_json))
                Severity: Minor
                Found in lib/dnsmadeeasy/api/client.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def initialize(api_key, api_secret, sandbox = false, options = {})
                        fail 'api_key is undefined' unless api_key
                        fail 'api_secret is undefined' unless api_secret
                
                        @api_key            = api_key
                Severity: Minor
                Found in lib/dnsmadeeasy/api/client.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

                Use options['mxLevel'] = priority instead of options.merge!('mxLevel' => priority).
                Open

                        options.merge!('mxLevel' => priority)
                Severity: Minor
                Found in lib/dnsmadeeasy/api/client.rb by rubocop

                This cop identifies places where Hash#merge! can be replaced by Hash#[]=.

                Example:

                hash.merge!(a: 1)
                hash.merge!({'key' => 'value'})
                hash.merge!(a: 1, b: 2)

                There are no issues that match your filters.

                Category
                Status