yast/yast-network

View on GitHub
src/lib/y2network/clients/routing.rb

Summary

Maintainability
C
1 day
Test Coverage

File routing.rb has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"
require "y2network/config"
require "y2network/wicked/config_writer"
require "y2network/serializer/route_sysconfig"

Severity: Minor
Found in src/lib/y2network/clients/routing.rb - About 4 hrs to fix

    Method cmdline_definition has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def cmdline_definition
            {
              # Commandline help title
              "help"       => _("Routing Configuration"),
              "id"         => "routing",
    Severity: Major
    Found in src/lib/y2network/clients/routing.rb - About 3 hrs to fix

      Class Routing has 25 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Routing < Yast::Client
            include Yast::Logger
      
            # Constructor
            def initialize
      Severity: Minor
      Found in src/lib/y2network/clients/routing.rb - About 2 hrs to fix

        Method EditHandler has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def EditHandler(options)
                destination = options["dest"]
        
                if destination == ""
                  CommandLine.Error(_("Destination IP address must be specified."))
        Severity: Minor
        Found in src/lib/y2network/clients/routing.rb - About 1 hr to fix

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

                def forwarding_handler(options, protocol)
                  forward_ivars = {
                    "IPv4" => :forward_ipv4,
                    "IPv6" => :forward_ipv6
                  }
          Severity: Minor
          Found in src/lib/y2network/clients/routing.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

          There are no issues that match your filters.

          Category
          Status