yast/yast-network

View on GitHub

Showing 218 of 255 total issues

Method Packages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def Packages
      backend = if Mode.autoinst
        Y2Network::Backend.all.find { |b| b.id == proposal_settings.current_backend }
      else
        yast_config&.backend
Severity: Minor
Found in src/modules/Lan.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 command_line_definition has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def command_line_definition
      {
        # Commandline help title
        "help"       => _(
          "Remote Access Configuration"
Severity: Minor
Found in src/clients/remote.rb - About 1 hr to fix

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

        def main
          Yast.import "UI"
    
          textdomain "network"
    
    
    Severity: Minor
    Found in src/clients/network.rb - About 1 hr 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 Update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def Update(oldhn, newhn, ip)
              raise ArgumentError, "IP cannot be nil" if ip.nil?
              raise ArgumentError, "Nonempty IP expected" if ip.empty?
        
              log.info("Updating /etc/hosts: #{oldhn} -> #{newhn}: #{ip}")
        Severity: Minor
        Found in src/modules/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 validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def validate
                return true if value != :bootproto_static
        
                ipa = Yast::UI.QueryWidget(:bootproto_ipaddr, :Value)
                if !Yast::IP.Check(ipa)
        Severity: Minor
        Found in src/lib/y2network/widgets/boot_protocol.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 tabs_descr has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def tabs_descr
              return @tabs_descr if @tabs_descr
        
              @tabs_descr = {
                "global"   => {
        Severity: Minor
        Found in src/include/network/lan/complex.rb - About 1 hr to fix

          Method contents has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def contents
                  RadioButtonGroup(
                    VBox(
                      # Small spacing (bsc#988904)
                      VSpacing(0.3),
          Severity: Minor
          Found in src/lib/y2remote/widgets/remote.rb - About 1 hr to fix

            Method option_handlers has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def option_handlers
                    {
                      hostname    => {
                        "validator"    => fun_ref(method(:valid_hostname?), "boolean (string)"),
                        "setter"       => fun_ref(method(:SetHostname), "void (any)"),
            Severity: Minor
            Found in src/lib/y2network/clients/dns.rb - About 1 hr to fix

              Method PackagesInstall has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def PackagesInstall(packages)
                    packages = deep_copy(packages)
                    return :next if packages == []
              
                    log.info "Checking packages: #{packages}"
              Severity: Minor
              Found in src/include/network/routines.rb - About 1 hr to fix

                Method LanSequence has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def LanSequence
                      aliases = {
                        "read"  => [-> { ReadDialog() }, true],
                        "main"  => -> { MainSequence("") },
                        "write" => [-> { WriteDialog() }, true]
                Severity: Minor
                Found in src/include/network/lan/wizards.rb - About 1 hr to fix

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

                        def EditHandler(options)
                          log.info("Edit handler, options: #{options.inspect}")
                  
                          # validator: a reference to boolean( string) is expected
                          # setter: a reference to void( any) is expected
                  Severity: Minor
                  Found in src/lib/y2network/clients/dns.rb - About 1 hr to fix

                    Method update_builder_from_options! has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def update_builder_from_options!(builder, options)
                          case builder.type.short_name
                          when "bond"
                            # change only if user specify it
                            builder.ports = options["bond_ports"].split if options["bond_ports"]
                    Severity: Minor
                    Found in src/include/network/lan/cmdline.rb - About 1 hr to fix

                      Method dialog has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              def dialog(value = nil)
                                value ||= ""
                                Yast::UI.OpenDialog(
                                  Opt(:decorated),
                                  VBox(
                      Severity: Minor
                      Found in src/lib/y2network/dialogs/wireless_wep_keys.rb - About 1 hr to fix

                        Method contents has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def contents
                                Frame(
                                  Id(:additional_addresses),
                                  # Frame label
                                  _("Additional Addresses"),
                        Severity: Minor
                        Found in src/lib/y2network/widgets/additional_addresses.rb - About 1 hr to fix

                          Method handle has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def handle(event)
                                    return nil if event["EventReason"] != "Activated"
                          
                                    cur = Yast::UI.QueryWidget(Id(:wep_keys_table), :CurrentItem).to_i
                                    case event["ID"]
                          Severity: Minor
                          Found in src/lib/y2network/dialogs/wireless_wep_keys.rb - About 1 hr to fix

                            Method main has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def main
                                  Yast.import "UI"
                                  textdomain "network"
                            
                                  Yast.import "Arch"
                            Severity: Minor
                            Found in src/modules/Lan.rb - About 1 hr to fix

                              Method contents has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def contents
                                      HBox(
                                        HSpacing(4),
                                        VBox(
                                          VSpacing(0.5),
                              Severity: Minor
                              Found in src/lib/y2network/dialogs/wireless_expert_settings.rb - About 1 hr to fix

                                Method help has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      def help
                                        res = _(
                                          "<p><b><big>Address Setup</big></b></p>\n" \
                                          "<p>Select <b>No Address Setup</b> if you do not want " \
                                          "to assign an IP address to this device.\n" \
                                Severity: Minor
                                Found in src/lib/y2network/widgets/boot_protocol.rb - About 1 hr to fix

                                  Method contents has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        def contents
                                          ifplugd_widget = IfplugdPriority.new(@settings)
                                          MarginBox(
                                            1,
                                            0,
                                  Severity: Minor
                                  Found in src/lib/y2network/widgets/general_tab.rb - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language