kkirsche/net-netconf

View on GitHub

Showing 12 of 14 total issues

Method load_configuration has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def load_configuration(*args)
        config = nil

        # default format is XML
        attrs = { format: 'xml' }
Severity: Minor
Found in lib/net/netconf/jnpr/rpc.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 waitfor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def self.waitfor(on_re = nil)
    time_out = @trans_timeout
    wait_io = @trans_waitio

    time_out = nil if time_out == false
Severity: Minor
Found in lib/net/netconf.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 load_configuration has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def load_configuration(*args)
        config = nil

        # default format is XML
        attrs = { format: 'xml' }
Severity: Minor
Found in lib/net/netconf/jnpr/rpc.rb - About 1 hr to fix

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

          def Builder.method_missing( method, params = nil, attrs = nil )
    
            rpc_name = method.to_s.tr('_','-').to_sym
    
            if params
    Severity: Minor
    Found in lib/net/netconf/rpc.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 edit_config has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def edit_config( *args ) # :yeield: config_builder
    
          toplevel = 'config'   # default toplevel config element
          target = 'candidate'  # default source is 'candidate'  @@@/JLS hack; need to fix this
          config = nil
    Severity: Minor
    Found in lib/net/netconf/rpc_std.rb - About 1 hr to fix

      Method request_pfe_execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def request_pfe_execute(params = nil)
              raise ArgumentError, 'Manditorary argument :target missing' unless params[:target]
              raise ArgumentError, 'Manditorary argument :command missing' unless params[:command]
      
              rpc_nx = Nokogiri::XML::Builder.new do |xml|
      Severity: Minor
      Found in lib/net/netconf/jnpr/rpc.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize( args_h, &block )
            os_type = args_h[:os_type] || Netconf::DEFAULT_OS_TYPE
      
            raise Netconf::InitError, "Missing 'port' param" unless args_h[:port]
            raise Netconf::InitError, "Missing 'username' param" unless args_h[:username]
      Severity: Minor
      Found in lib/net/netconf/serial.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 trans_receive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def trans_receive
            @trans[:rx_buf] = ''
            @trans[:more] = true
      
            # collect the response data as it comes back ...
      Severity: Minor
      Found in lib/net/netconf/ssh.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 get_configuration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def get_configuration(*args)
              filter = nil
      
              while arg = args.shift
                case arg.class.to_s
      Severity: Minor
      Found in lib/net/netconf/jnpr/rpc.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 trans_open has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def trans_open(&block)
            # open a connection to the NETCONF subsystem
            start_args = {}
            start_args[:password] ||= @args[:password]
            start_args[:passphrase] = @args[:passphrase] || nil
      Severity: Minor
      Found in lib/net/netconf/ssh.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 rpc_exec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def rpc_exec( cmd_nx )
            raise Netconf::StateError unless @state == :NETCONF_OPEN         
            
            # add the mandatory message-id and namespace to the RPC
            
      Severity: Minor
      Found in lib/net/netconf/transport.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 process_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_args(args)
            while arg = args.shift
              case arg.class.to_s
              when /^Nokogiri/
                filter = case arg
      Severity: Minor
      Found in lib/net/netconf/rpc_std.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