kigster/dnsmadeeasy

View on GitHub

Showing 52 of 53 total issues

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 print_help_message has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def print_help_message
            print_usage_message
            puts <<~EOF
      
              #{header 'Credentials'}
      Severity: Minor
      Found in lib/dnsmadeeasy/runner.rb - About 1 hr to fix

        Method credentials_from_array has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def credentials_from_array(accounts, account_name = nil)
                account = if account_name
                            accounts.find { |a| a.name == account_name }
                          elsif accounts.size == 1
                            accounts.first
        Severity: Minor
        Found in lib/dnsmadeeasy/credentials/yaml_file.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_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 keys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def keys(account: nil, encryption_key: nil)
                  return nil unless exist?
                  return nil if mash.nil?
          
                  creds = if mash.accounts.is_a?(Array)
          Severity: Minor
          Found in lib/dnsmadeeasy/credentials/yaml_file.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 print_formatted has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def print_formatted(result, format = nil)
                if format
                  if format.to_sym == :json_pretty
                    puts JSON.pretty_generate(result)
                  elsif format.to_sym == :pp
          Severity: Minor
          Found in lib/dnsmadeeasy/runner.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 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 configure_authentication has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def configure_authentication
                        credentials_file = ENV['DNSMADEEASY_CREDENTIALS_FILE'] ||
                          DnsMadeEasy::Credentials.default_credentials_path(user: Etc.getlogin)
                  
                        if ENV['DNSMADEEASY_API_KEY'] && ENV['DNSMADEEASY_API_SECRET']
                  Severity: Minor
                  Found in lib/dnsmadeeasy/runner.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 process_flags_format has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def process_flags_format
                        if argv.first =~ /^op(erations)?$/i
                          print_supported_operations
                  
                        elsif argv.include?('--help') || argv.include?('-h')
                  Severity: Minor
                  Found in lib/dnsmadeeasy/runner.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 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 method_signature has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def method_signature(e, method)
                        file, line, call_method = e.backtrace.first.split(':')
                        call_method = call_method.gsub(/[']/, '').split('`').last
                        if call_method && call_method.to_sym == method.to_sym
                          source_line = File.open(file).to_a[line.to_i - 1].chomp!
                  Severity: Minor
                  Found in lib/dnsmadeeasy/runner.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

                  unexpected $' (Using Ruby 2.1 parser; configure usingTargetRubyVersionparameter, underAllCops`)
                  Open

                    $ dme domain moo.com
                  Severity: Minor
                  Found in lib/dnsmadeeasy/runner.rb by rubocop

                  Freeze mutable objects assigned to constants.
                  Open

                    API_BASE_URL_PRODUCTION = 'https://api.dnsmadeeasy.com/V2.0'
                  Severity: Minor
                  Found in lib/dnsmadeeasy.rb by rubocop

                  This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

                  Example:

                  # bad
                  CONST = [1, 2, 3]
                  
                  # good
                  CONST = [1, 2, 3].freeze

                  unexpected token tCOLON (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
                  Open

                        credentials:
                  Severity: Minor
                  Found in lib/dnsmadeeasy/runner.rb by rubocop

                  unexpected token error (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
                  Open

                                    credentials_from_array(mash.accounts, account&.to_s)
                  Severity
                  Category
                  Status
                  Source
                  Language