yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

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

    def GetMenuButtonWidget(actions, save, mb_label)
      actions = deep_copy(actions)
      menubutton = []
      if save
        # menubutton entry
Severity: Minor
Found in library/log/src/modules/LogView.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

Avoid deeply nested control flow statements.
Open

              if firstspace.nil?
                modulename = module_data
                moduleargs = ""
              else
                modulename = Builtins.substring(module_data, 0, firstspace)
Severity: Major
Found in library/system/src/modules/ModuleLoading.rb - About 45 mins to fix

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

        def RunDepmod(force)
          Yast.import "Kernel"
    
          kernel_version = Convert.to_string(
            SCR.Read(
    Severity: Minor
    Found in library/system/src/modules/ModulesConf.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

    Avoid deeply nested control flow statements.
    Open

                  command << Builtins.sformat(" | tail -n +%1", lines_count.to_s.shellescape) if Ops.greater_than(lines_count, 0)
    Severity: Major
    Found in library/log/src/modules/LogViewCore.rb - About 45 mins to fix

      Method New has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def New(window_title, progress_title, length, stg, tits, help_text)
      Severity: Minor
      Found in library/wizard/src/modules/Progress.rb - About 45 mins to fix

        Method Load has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def Load(modulename, moduleargs, vendorname, devicename, ask_before_loading, with_modprobe)
        Severity: Minor
        Found in library/system/src/modules/ModuleLoading.rb - About 45 mins to fix

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

              def FileChangedFromPackage(file)
                # queryformat: no trailing newline!
                cmd = Builtins.sformat(
                  "/usr/bin/rpm -qf %1 --qf %%{NAME}-%%{VERSION}-%%{RELEASE}",
                  file.shellescape
          Severity: Minor
          Found in library/system/src/modules/FileChanges.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

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

              def OpenFirewallHandle(widget, _key, event)
                widget = deep_copy(widget)
                event = deep_copy(event)
                event_id = Ops.get(event, "ID")
                if event_id == "_cwm_firewall_details"
          Severity: Minor
          Found in library/network/src/modules/CWMFirewallInterfaces.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

          Avoid deeply nested control flow statements.
          Open

                        module_data = Builtins.substring(module_data, firstspace) if !firstspace.nil?
          Severity: Major
          Found in library/system/src/modules/ModuleLoading.rb - About 45 mins to fix

            Method SetContentsFocus has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def SetContentsFocus(title, contents, help_text, has_back, has_next, set_focus)
            Severity: Minor
            Found in library/wizard/src/modules/Wizard.rb - About 45 mins to fix

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

                  def GetTypeFromIfcfg(ifcfg)
                    ifcfg = deep_copy(ifcfg)
                    type = nil
              
                    return nil if IsEmpty(ifcfg)
              Severity: Minor
              Found in library/network/src/modules/NetworkInterfaces.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

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

                  def SignFile(keyid, file, passphrase, ascii_signature)
                    if passphrase.nil? || keyid.nil? || keyid == "" || file.nil? ||
                        file == ""
                      Builtins.y2error(
                        "Invalid parameters: keyid: %1, file: %2, passphrase: %3",
              Severity: Minor
              Found in library/gpg/src/modules/GPG.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

              Avoid deeply nested control flow statements.
              Open

                            lines_count = 0 if Ops.less_than(lines_count, 0)
              Severity: Major
              Found in library/log/src/modules/LogViewCore.rb - About 45 mins to fix

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

                    def LogHandle(_key, event)
                      event = deep_copy(event)
                      @param = CWM.GetProcessedWidget
                      LogViewCore.Update(Id(:_cwm_log))
                      ret = Ops.get(event, "ID")
                Severity: Minor
                Found in library/log/src/modules/LogView.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

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

                    def CreateOpenFirewallWidget(settings)
                      settings = deep_copy(settings)
                
                      services = adapt_settings_services!(settings)
                
                
                Severity: Minor
                Found in library/network/src/modules/CWMFirewallInterfaces.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

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

                    def AddServiceSupportIntoZone(service, zone)
                      Yast.import "SuSEFirewallServices" # lazy import due to circular dependencies
                
                      needed = SuSEFirewallServices.GetNeededPortsAndProtocols(service)
                      # unknown service
                Severity: Minor
                Found in library/network/src/lib/network/susefirewall2.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

                Avoid deeply nested control flow statements.
                Open

                                  if SuSEFirewall.HaveService(one_port, "TCP", zone) != true
                                    set_vnc_enabled_to = false
                                    raise Break
                                  end
                Severity: Major
                Found in library/network/src/modules/SuSEFirewallProposal.rb - About 45 mins to fix

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

                      def SetServicesForZones(services_ids, firewall_zones, new_status)
                        # setting for each service
                        Builtins.foreach(services_ids) do |service_id|
                          Builtins.foreach(firewall_zones) do |firewall_zone|
                            # zone must be known one
                  Severity: Minor
                  Found in library/network/src/lib/network/susefirewall2.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

                  Method AddForwardIntoMasqueradeRule has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def AddForwardIntoMasqueradeRule(source_net, forward_to_ip, protocol, req_port, redirect_to_port, requested_ip)
                  Severity: Minor
                  Found in library/network/src/lib/network/susefirewall2.rb - About 45 mins to fix

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

                        def SetFirewallKernelModules(k_modules)
                          k_modules = deep_copy(k_modules)
                          k_modules = Builtins.filter(k_modules) do |one_module|
                            if one_module.nil?
                              Builtins.y2error(
                    Severity: Minor
                    Found in library/network/src/lib/network/susefirewall2.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

                    Severity
                    Category
                    Status
                    Source
                    Language