ddollar/foreman

View on GitHub

Showing 11 of 11 total issues

Class Engine has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

class Foreman::Engine

  # The signals that the engine cares about.
  #
  HANDLED_SIGNALS = [ :TERM, :INT, :HUP, :USR1, :USR2 ]
Severity: Minor
Found in lib/foreman/engine.rb - About 5 hrs to fix

    File engine.rb has 316 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "foreman"
    require "foreman/env"
    require "foreman/process"
    require "foreman/procfile"
    require "tempfile"
    Severity: Minor
    Found in lib/foreman/engine.rb - About 3 hrs to fix

      Method run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def run(*args)
          load_environment!
      
          if File.file?(procfile)
            engine.load_procfile(procfile)
      Severity: Minor
      Found in lib/foreman/cli.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 kill_children has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def kill_children(signal="SIGTERM")
          if Foreman.windows?
            @running.each do |pid, (process, index)|
              system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
              begin
      Severity: Minor
      Found in lib/foreman/engine.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 export has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def export
          error("Must specify a location") unless location
      
          inittab = []
          inittab << "# ----- foreman #{app} processes -----"
      Severity: Minor
      Found in lib/foreman/export/inittab.rb - About 1 hr to fix

        Method constantize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def constantize(camel_cased_word)
            camel_cased_word = camel_cased_word.to_s
        
            names = camel_cased_word.split('::')
            names.shift if names.empty? || names.first.empty?
        Severity: Minor
        Found in lib/foreman/helpers.rb - About 45 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 wait_for_shutdown_or_child_termination has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def wait_for_shutdown_or_child_termination
            loop do
              # Stop if it is time to shut down (asked via a signal)
              break if @shutdown
        
        
        Severity: Minor
        Found in lib/foreman/engine.rb - About 45 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 terminate_gracefully has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def terminate_gracefully
            restore_default_signal_handlers
        
            # Tell all children to stop gracefully
            if Foreman.windows?
        Severity: Minor
        Found in lib/foreman/engine.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 export has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def export
            super
        
            (Dir["#{location}/#{app}-*.conf"] << "#{location}/#{app}.conf").each do |file|
              clean file
        Severity: Minor
        Found in lib/foreman/export/daemon.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 handle_io has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def handle_io(readers)
            readers.each do |reader|
              next if reader == @selfpipe[:reader]
        
              if reader.eof?
        Severity: Minor
        Found in lib/foreman/engine.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

        Method watch_for_output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def watch_for_output
            Thread.new do
              begin
                loop do
                  io = IO.select([@selfpipe[:reader]] + @readers.values, nil, nil, 30)
        Severity: Minor
        Found in lib/foreman/engine.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

        Severity
        Category
        Status
        Source
        Language