hirura/hrr_rb_netconf

View on GitHub

Showing 45 of 63 total issues

Method filter_recursively has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

          def filter_recursively selected_element_xpaths, output_e, raw_output_e, filter_e, options={}
            if filter_e
              if raw_output_e.name == filter_e.name
                # Namespace Selection
                filter_namespace = options['namespace'] || filter_e.namespace
Severity: Minor
Found in lib/hrr_rb_netconf/server/filter/subtree.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 validate_recursively has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_recursively node, xml_e, parent_xml_e: nil, validated: []
        case node.stmt
        when 'root', 'container'
          case xml_e
          when nil
Severity: Minor
Found in lib/hrr_rb_netconf/server/model.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 start_notification_replay_thread has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

      def start_notification_replay_thread stream, start_time, stop_time, events
        @notification_replay_thread = Thread.new do
          log_info { "Notification replay start for stream: #{stream}" }
          begin
            @monitor.synchronize do
Severity: Minor
Found in lib/hrr_rb_netconf/server/session.rb - About 5 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 receive_message has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

          def receive_message
            chunk_size = StringIO.new
            chunked_msg = StringIO.new
            decoded_msg = StringIO.new
            read_len = 1
Severity: Minor
Found in lib/hrr_rb_netconf/server/capability/base_1_1.rb - About 4 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 define_capability has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

        def define_capability
          oper_proc('create-subscription'){ |session, datastore, input_e|
            stream_e = input_e.elements['stream']
            unless stream_e
              log_debug { "create-subscription doesn't have stream, so use NETCONF stream" }
Severity: Minor
Found in lib/hrr_rb_netconf/server/capability/notification_1_0.rb - About 3 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 validate_recursively has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def validate_recursively node, xml_e, parent_xml_e: nil, validated: []
        case node.stmt
        when 'root', 'container'
          case xml_e
          when nil
Severity: Major
Found in lib/hrr_rb_netconf/server/model.rb - About 3 hrs to fix

    Method receive_message has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def receive_message
                chunk_size = StringIO.new
                chunked_msg = StringIO.new
                decoded_msg = StringIO.new
                read_len = 1
    Severity: Major
    Found in lib/hrr_rb_netconf/server/capability/base_1_1.rb - About 3 hrs to fix

      File session.rb has 292 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'time'
      require 'date'
      require 'thread'
      require 'monitor'
      require 'rexml/document'
      Severity: Minor
      Found in lib/hrr_rb_netconf/server/session.rb - About 3 hrs to fix

        Method operation_loop has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

              def operation_loop
                datastore_session = @datastore.new_session self
                operation = Operation.new self, @capabilities, datastore_session, @strict_capabilities, @enable_filter, logger: logger
        
                begin
        Severity: Minor
        Found in lib/hrr_rb_netconf/server/session.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 filter_recursively has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def filter_recursively selected_element_xpaths, output_e, raw_output_e, filter_e, options={}
                    if filter_e
                      if raw_output_e.name == filter_e.name
                        # Namespace Selection
                        filter_namespace = options['namespace'] || filter_e.namespace
        Severity: Major
        Found in lib/hrr_rb_netconf/server/filter/subtree.rb - About 2 hrs to fix

          Method define_capability has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def define_capability
                    oper_proc('get'){ |session, datastore, input_e|
                      datastore.run 'get', input_e
                    }
          
          
          Severity: Major
          Found in lib/hrr_rb_netconf/server/capability/base_1_0.rb - About 2 hrs to fix

            Method define_capability has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def define_capability
                      oper_proc('get'){ |session, datastore, input_e|
                        datastore.run 'get', input_e
                      }
            
            
            Severity: Major
            Found in lib/hrr_rb_netconf/server/capability/base_1_1.rb - About 2 hrs to fix

              Class Session has 24 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Session
                    include Loggable
              
                    attr_reader :session_id
              
              
              Severity: Minor
              Found in lib/hrr_rb_netconf/server/session.rb - About 2 hrs to fix

                Method define_capability has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def define_capability
                          oper_proc('create-subscription'){ |session, datastore, input_e|
                            stream_e = input_e.elements['stream']
                            unless stream_e
                              log_debug { "create-subscription doesn't have stream, so use NETCONF stream" }
                Severity: Major
                Found in lib/hrr_rb_netconf/server/capability/notification_1_0.rb - About 2 hrs to fix

                  Class Capability has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class Capability
                        include Loggable
                  
                        @subclass_list = Array.new
                  
                  
                  Severity: Minor
                  Found in lib/hrr_rb_netconf/server/capability.rb - About 2 hrs to fix

                    Method to_rpc_error has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def to_rpc_error
                              xml_doc = REXML::Document.new
                              rpc_error_e = xml_doc.add_element 'rpc-error'
                              tag_e = rpc_error_e.add_element 'error-tag'
                              tag_e.text = @tag
                    Severity: Minor
                    Found in lib/hrr_rb_netconf/server/error/rpc_errorable.rb - About 1 hr to fix

                      Method operation_loop has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def operation_loop
                              datastore_session = @datastore.new_session self
                              operation = Operation.new self, @capabilities, datastore_session, @strict_capabilities, @enable_filter, logger: logger
                      
                              begin
                      Severity: Minor
                      Found in lib/hrr_rb_netconf/server/session.rb - About 1 hr to fix

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

                              def run xml_doc
                                unless xml_doc.root.name == 'rpc'
                                  log_error { "Invalid root tag: must be rpc, but got #{xml_doc.root.name}" }
                                  raise Error['operation-not-supported'].new('protocol', 'error', logger: logger)
                                end
                        Severity: Minor
                        Found in lib/hrr_rb_netconf/server/operation.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 run has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def run xml_doc
                                unless xml_doc.root.name == 'rpc'
                                  log_error { "Invalid root tag: must be rpc, but got #{xml_doc.root.name}" }
                                  raise Error['operation-not-supported'].new('protocol', 'error', logger: logger)
                                end
                        Severity: Minor
                        Found in lib/hrr_rb_netconf/server/operation.rb - About 1 hr to fix

                          Method send_message has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    def send_message msg
                                      raw_msg = StringIO.new
                                      case msg
                                      when String
                                        begin
                          Severity: Minor
                          Found in lib/hrr_rb_netconf/server/capability/base_1_1.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language