yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

Method InterfacesValidate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def InterfacesValidate(_widget, _key, _event)
      trusted_zone = firewalld.find_zone("trusted")

      ifaces = Convert.convert(
        UI.QueryWidget(Id("_cwm_interface_list"), :SelectedItems),
Severity: Minor
Found in library/network/src/modules/CWMFirewallInterfaces.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 Selected2Opened has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def Selected2Opened(ifaces, _nm_ifaces_have_to_be_selected)
      log.info("Selected ifaces: #{ifaces}")
      zone_names = ifaces.map do |name|
        zone = interface_zone(name)
        zone ? zone.name : default_zone.name
Severity: Minor
Found in library/network/src/modules/CWMFirewallInterfaces.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 getProposals has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def getProposals(stage, mode, proptype)
      props = getMatchingProposal(stage, mode, proptype)
      unique_id = Ops.get_string(props, [0, "unique_id"], "")
      disabled_subprops = GetDisabledSubProposals()

Severity: Minor
Found in library/control/src/modules/ProductControl.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 TimedOKCancel has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def TimedOKCancel(message, timeout_seconds)
      success = UI.OpenDialog(
        Opt(:decorated),
        HBox(
          HSpacing(1),
Severity: Minor
Found in library/general/src/modules/Popup.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 find_longest_records has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def find_longest_records(items)
      return [] unless items

      # searching all rows
      items.each_with_object([]) do |row, result|
Severity: Minor
Found in library/types/src/modules/String.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 main has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def main
      Yast.import "UI"

      Yast.import "Arch"
      Yast.import "Label"
Severity: Minor
Found in library/system/src/modules/Initrd.rb - About 1 hr to fix

    Method GetAdditionalServices has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def GetAdditionalServices(protocol, zone)
          if !IsSupportedProtocol(protocol)
            Builtins.y2error("Unknown protocol '%1'", protocol)
            return nil
          end
    Severity: Minor
    Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

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

          def main
            Yast.import "Stage"
            Yast.import "Linuxrc"
            Yast.import "Directory"
      
      
      Severity: Minor
      Found in library/control/src/modules/Installation.rb - About 1 hr to fix

        Method SignFile has 42 lines of code (exceeds 25 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 1 hr to fix

          Method AddForwardIntoMasqueradeRule has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def AddForwardIntoMasqueradeRule(source_net, forward_to_ip, protocol, req_port, redirect_to_port, requested_ip)
                SetModified()
          
                masquerade_rules = Ops.get_string(@SETTINGS, "FW_FORWARD_MASQ", "")
          
          
          Severity: Minor
          Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

            Method TimedAnyQuestion has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def TimedAnyQuestion(headline, message, yes_button_message, no_button_message, focus, timeout_seconds)
                  button_box = AnyQuestionButtonBox(
                    yes_button_message,
                    no_button_message,
                    focus
            Severity: Minor
            Found in library/general/src/modules/Popup.rb - About 1 hr to fix

              Method TimedOKCancel has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def TimedOKCancel(message, timeout_seconds)
                    success = UI.OpenDialog(
                      Opt(:decorated),
                      HBox(
                        HSpacing(1),
              Severity: Minor
              Found in library/general/src/modules/Popup.rb - About 1 hr to fix

                Method PushState has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def PushState
                      current_subprogress = CurrentSubprogressType()
                      state = {
                        # global variable
                        "stages"               => @stages,
                Severity: Minor
                Found in library/wizard/src/modules/Progress.rb - About 1 hr to fix

                  Method CreateKey has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def CreateKey
                        command = Ops.add("GPG_AGENT_INFO='' ", buildGPGcommand("--gen-key"))
                        text_mode = Ops.get_boolean(UI.GetDisplayInfo, "TextMode", false)
                  
                        Builtins.y2debug("text_mode: %1", text_mode)
                  Severity: Minor
                  Found in library/gpg/src/modules/GPG.rb - About 1 hr to fix

                    Method PrepareScripts has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def PrepareScripts(workflow)
                          workflow = deep_copy(workflow)
                          tmp_dir = Convert.to_string(WFM.Read(path(".local.tmpdir"), []))
                          if Builtins.haskey(workflow, "prescript")
                            interpreter = Ops.get_string(workflow, ["prescript", "interpreter"], "shell")
                    Severity: Minor
                    Found in library/control/src/modules/ProductControl.rb - About 1 hr to fix

                      Method SaveLogs has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def SaveLogs
                            env_home = ENV["HOME"]
                      
                            homedir = if env_home && !env_home.empty?
                              env_home
                      Severity: Minor
                      Found in library/control/src/modules/InstError.rb - About 1 hr to fix

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

                            def Start(log)
                              if (@type == "dsl" && @capi_adsl) || @type == "isdn"
                                status = Service.Status("isdn")
                                Builtins.y2milestone("We need ISDN service, status: %1", status)
                                if status != 0 && !Service.Start("isdn")
                        Severity: Minor
                        Found in library/network/src/modules/Internet.rb - About 1 hr to fix

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

                              def FindBaseProducts
                                return unless load_zypp
                          
                                log.info "Looking for base products"
                          
                          
                          Severity: Minor
                          Found in library/packages/src/modules/Product.rb - About 1 hr to fix

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

                                def CreateLdapWidget(settings)
                                  settings = deep_copy(settings)
                            
                                  use_ldap_checkbox = Ops.get_locale(
                                    settings,
                            Severity: Minor
                            Found in library/cwm/src/modules/CWMServiceStart.rb - About 1 hr to fix

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

                                  def ValidateMaps(widgets)
                                    widgets = deep_copy(widgets)
                                    ret = true
                                    Builtins.foreach(widgets) do |k, v|
                                      Builtins.foreach(v) do |kk, vv|
                              Severity: Minor
                              Found in library/cwm/src/modules/CWM.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language