kigster/dnsmadeeasy

View on GitHub
lib/dnsmadeeasy/runner.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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 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 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 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

    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 tCOLON (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
    Open

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

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

            api_secret: YYYY'.cyan}
    Severity: Minor
    Found in lib/dnsmadeeasy/runner.rb by rubocop

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

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

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

            api_secret: WWWW'.cyan}
    Severity: Minor
    Found in lib/dnsmadeeasy/runner.rb by rubocop

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

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

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

          puts header 'Examples:'
    Severity: Minor
    Found in lib/dnsmadeeasy/runner.rb by rubocop

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

              Store your credentials in a YAML file #{DnsMadeEasy::Credentials.default_credentials_path(user: ENV['USER']).blue}
    Severity: Minor
    Found in lib/dnsmadeeasy/runner.rb by rubocop

    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 $' (Using Ruby 2.1 parser; configure usingTargetRubyVersionparameter, underAllCops`)
    Open

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

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

        - name: production
    Severity: Minor
    Found in lib/dnsmadeeasy/runner.rb by rubocop

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

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

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

        - name: development
    Severity: Minor
    Found in lib/dnsmadeeasy/runner.rb by rubocop

    There are no issues that match your filters.

    Category
    Status