hgoodman/asa-console

View on GitHub
lib/asa_console/terminal/fake_ssh.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method connect has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def connect
        @session = Class.new do
          def initialize
            @closed = false
          end
Severity: Minor
Found in lib/asa_console/terminal/fake_ssh.rb - About 1 hr to fix

    Block has too many lines. [27/25]
    Open

            @channel = Class.new do
              attr_reader :terminal
              def initialize(terminal)
                @terminal = terminal
                @input_buffer = ''

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Always use raise to signal exceptions.
    Open

              fail Error::ConnectFailure 'Failed to parse EXEC prompt', self unless success

    This cop checks for uses of fail and raise.

    Example: EnforcedStyle: only_raise (default)

    # The `only_raise` style enforces the sole use of `raise`.
    # bad
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail
    
    # good
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise

    Example: EnforcedStyle: only_fail

    # The `only_fail` style enforces the sole use of `fail`.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail

    Example: EnforcedStyle: semantic

    # The `semantic` style enforces the use of `fail` to signal an
    # exception, then will use `raise` to trigger an offense after
    # it has been rescued.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      # Error thrown
    rescue Exception
      fail
    end
    
    Kernel.fail
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      raise 'Preferably with descriptive message'
    end
    
    explicit_receiver.fail
    explicit_receiver.raise

    Always use raise to signal exceptions.
    Open

            fail Error::MissingOptionError, 'Option :input_proc is missing or invalid' \

    This cop checks for uses of fail and raise.

    Example: EnforcedStyle: only_raise (default)

    # The `only_raise` style enforces the sole use of `raise`.
    # bad
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail
    
    # good
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise

    Example: EnforcedStyle: only_fail

    # The `only_fail` style enforces the sole use of `fail`.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail

    Example: EnforcedStyle: semantic

    # The `semantic` style enforces the use of `fail` to signal an
    # exception, then will use `raise` to trigger an offense after
    # it has been rescued.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      # Error thrown
    rescue Exception
      fail
    end
    
    Kernel.fail
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      raise 'Preferably with descriptive message'
    end
    
    explicit_receiver.fail
    explicit_receiver.raise

    Always use raise to signal exceptions.
    Open

                fail Net::SSH::Disconnect if @terminal.session.closed?

    This cop checks for uses of fail and raise.

    Example: EnforcedStyle: only_raise (default)

    # The `only_raise` style enforces the sole use of `raise`.
    # bad
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail
    
    # good
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise

    Example: EnforcedStyle: only_fail

    # The `only_fail` style enforces the sole use of `fail`.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail

    Example: EnforcedStyle: semantic

    # The `semantic` style enforces the use of `fail` to signal an
    # exception, then will use `raise` to trigger an offense after
    # it has been rescued.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      # Error thrown
    rescue Exception
      fail
    end
    
    Kernel.fail
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      raise 'Preferably with descriptive message'
    end
    
    explicit_receiver.fail
    explicit_receiver.raise

    There are no issues that match your filters.

    Category
    Status