lib/roma/tools/mkconfig.rb

Summary

Maintainability
D
2 days
Test Coverage

File mkconfig.rb has 519 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'pathname'
require 'yaml'
require 'fileutils'

module Roma
Severity: Major
Found in lib/roma/tools/mkconfig.rb - About 1 day to fix

    Method store_result has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def store_result(results, base, hash, input)
          target = base[hash]
    
          return results if !target["name"]
    
    
    Severity: Minor
    Found in lib/roma/tools/mkconfig.rb - About 2 hrs 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 mkconfig has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def mkconfig(mode)
          skip = skip_menu!(mode)
    
          while true
            clear_screen
    Severity: Minor
    Found in lib/roma/tools/mkconfig.rb - About 2 hrs 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 save_data has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def save_data(res)
          if res.key?("storage")
            case res["storage"].value
            when "Ruby Hash"
              req = "rh_storage"
    Severity: Major
    Found in lib/roma/tools/mkconfig.rb - About 2 hrs to fix

      Method save_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def save_data(res)
            if res.key?("storage")
              case res["storage"].value
              when "Ruby Hash"
                req = "rh_storage"
      Severity: Minor
      Found in lib/roma/tools/mkconfig.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 correct_in? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def correct_in?(hash,input)
            if END_MSG.include?(input)
              return true
            end
      
      
      Severity: Minor
      Found in lib/roma/tools/mkconfig.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 skip_menu! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def skip_menu!(menu)
            # in case of "-m" or "--with_menu" option was used
            if menu == :with_menu
              return Proc.new do
                if @next_hash == "server" && @results["fd_server"]
      Severity: Minor
      Found in lib/roma/tools/mkconfig.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 ch_assign has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def ch_assign(text, exp, sep = " = ", str)
            sep = " = " if sep == "="
            text = text.gsub(/(\s*#{exp}).*/) do |s|
              name = $1
              if str.class == String
      Severity: Minor
      Found in lib/roma/tools/mkconfig.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

      Avoid too many return statements within this method.
      Open

            return false
      Severity: Major
      Found in lib/roma/tools/mkconfig.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                      return true
        Severity: Major
        Found in lib/roma/tools/mkconfig.rb - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status