puppetlabs/chloride

View on GitHub

Showing 15 of 15 total issues

Method go has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
Open

  def go(&stream_block)
    @status = :running
    @results = Hash.new { |h, k| h[k] = {} }
    @hosts.each do |host|
      # First try identifying using lsb_release.  This takes care of Ubuntu (lsb-release is part of ubuntu-minimal).
Severity: Minor
Found in lib/chloride/action/detect_platform.rb - About 2 days 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 execute has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

  def execute(cmd, sudo = false, &stream_block)
    results = { exit_status: nil, stdout: '', stderr: '' }
    sudo = false if @username == 'root'

    if sudo
Severity: Minor
Found in lib/chloride/host.rb - About 1 day 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 go has 152 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def go(&stream_block)
    @status = :running
    @results = Hash.new { |h, k| h[k] = {} }
    @hosts.each do |host|
      # First try identifying using lsb_release.  This takes care of Ubuntu (lsb-release is part of ubuntu-minimal).
Severity: Major
Found in lib/chloride/action/detect_platform.rb - About 6 hrs to fix

    Method execute has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def execute(cmd, sudo = false, &stream_block)
        results = { exit_status: nil, stdout: '', stderr: '' }
        sudo = false if @username == 'root'
    
        if sudo
    Severity: Major
    Found in lib/chloride/host.rb - About 3 hrs to fix

      Method execute has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def execute(steps)
          # Perform the plan given
          skip_remaining_steps = false
      
          steps.each do |step|
      Severity: Minor
      Found in lib/chloride/executor.rb - About 1 hr to fix

        Method ssh_connect has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def ssh_connect
            unless @localhost
              log = StringIO.new
              logger = Logger.new(log)
              logger.formatter = proc { |level, date, _progname, msg|
        Severity: Minor
        Found in lib/chloride/host.rb - About 1 hr to fix

          Method execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def execute(steps)
              # Perform the plan given
              skip_remaining_steps = false
          
              steps.each do |step|
          Severity: Minor
          Found in lib/chloride/executor.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 go has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def go(&stream_block)
                @status = :running
          
                begin
                  if @content
          Severity: Minor
          Found in lib/chloride/action/file_copy.rb - About 1 hr to fix

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

              def initialize(hostname, config = {})
                @hostname = hostname
                @username = if config[:username].nil? || config[:username].strip.empty?
                              'root'
                            else
            Severity: Minor
            Found in lib/chloride/host.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 ssh_connect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def ssh_connect
                unless @localhost
                  log = StringIO.new
                  logger = Logger.new(log)
                  logger.formatter = proc { |level, date, _progname, msg|
            Severity: Minor
            Found in lib/chloride/host.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 go has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def go(&stream_block)
                  @status = :running
            
                  if @from
                    begin
            Severity: Minor
            Found in lib/chloride/action/resolve_dns.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 go has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def go(&stream_block)
                  @status = :running
            
                  begin
                    if @content
            Severity: Minor
            Found in lib/chloride/action/file_copy.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 sudo_stdin has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def sudo_stdin(ch, info, data, sudo_prompt, &stream_block)
            Severity: Minor
            Found in lib/chloride/host.rb - About 35 mins to fix

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

                  def exec_and_log(host, cmd, sudo, results, &stream_block)
              Severity: Minor
              Found in lib/chloride/action.rb - About 35 mins to fix

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

                  def sudo_stdin(ch, info, data, sudo_prompt, &stream_block)
                    # Sudo handling
                    if data == sudo_prompt
                      if @sudo_password
                        ch.send_data "#{@sudo_password}\r\n"
                Severity: Minor
                Found in lib/chloride/host.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