yast/yast-yast2

View on GitHub

Showing 967 of 967 total issues

Method PrintActionHelp has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def PrintActionHelp(action)
      # lookup action in actions
      command = Ops.get_map(@allcommands, ["actions", action], {})
      # translators: the command does not provide any help
      commandhelp = Ops.get(command, "help")
Severity: Minor
Found in library/commandline/src/modules/CommandLine.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 main has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def main
      Yast.import "UI"

      textdomain "base"

Severity: Major
Found in library/desktop/src/clients/menu.rb - About 4 hrs to fix

    Method PrintGeneralHelp has 118 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def PrintGeneralHelp
          # display custom defined help instead of generic one
          if Builtins.haskey(@modulecommands, "customhelp")
            Print(Ops.get_string(@modulecommands, "customhelp", ""))
            return
    Severity: Major
    Found in library/commandline/src/modules/CommandLine.rb - About 4 hrs to fix

      File LogView.rb has 362 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "yast"
      
      module Yast
        class LogViewClass < Module
          def main
      Severity: Minor
      Found in library/log/src/modules/LogView.rb - About 4 hrs to fix

        Class SuSEFirewallClass has 36 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class SuSEFirewallClass < Module
            # @return [String] the systemd service name: "firewalld" or "SuSEfirewall2"
            attr_reader :firewall_service
        
            Yast.import "Mode"
        Severity: Minor
        Found in library/network/src/lib/network/susefirewall.rb - About 4 hrs to fix

          Method PrintActionHelp has 116 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def PrintActionHelp(action)
                # lookup action in actions
                command = Ops.get_map(@allcommands, ["actions", action], {})
                # translators: the command does not provide any help
                commandhelp = Ops.get(command, "help")
          Severity: Major
          Found in library/commandline/src/modules/CommandLine.rb - About 4 hrs to fix

            Method Load has 114 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def Load(modulename, moduleargs, vendorname, devicename, ask_before_loading, with_modprobe)
                  if modulename != "" &&
                      # there is no reason for checking initrd, if I need the module to get loaded, I just  need to
                      # check if it isn't already loaded
                      #      && (!contains (Initrd::ListModules (), modulename))
            Severity: Major
            Found in library/system/src/modules/ModuleLoading.rb - About 4 hrs to fix

              Class NetworkServiceClass has 35 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class NetworkServiceClass < Module
                  # return [String, nil] current network backend identification, nil is valid value for "no service selected / running"
                  attr_accessor :current_name
                  # return [String, nil] new network backend identification, nil is valid value for "no service selected / running"
                  attr_writer :cached_name
              Severity: Minor
              Found in library/network/src/modules/NetworkService.rb - About 4 hrs to fix

                Method DoneProvide has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def DoneProvide(error, reason, name)
                      Builtins.y2milestone("DoneProvide: %1, %2, %3", error, reason, name)
                
                      if @_provide_popup
                        UI.CloseDialog
                Severity: Major
                Found in library/packages/src/modules/PackageCallbacks.rb - About 4 hrs to fix

                  Method Build has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def Build(tokens)
                        tokens = deep_copy(tokens)
                        url = ""
                        userpass = ""
                  
                  
                  Severity: Major
                  Found in library/types/src/modules/URL.rb - About 4 hrs to fix

                    Method AddWizardSteps has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def AddWizardSteps(stagemode)
                          stagemode = deep_copy(stagemode)
                          debug_workflow = ProductFeatures.GetBooleanFeature(
                            "globals",
                            "debug_workflow"
                    Severity: Major
                    Found in library/control/src/modules/ProductControl.rb - About 4 hrs to fix

                      Class ReportClass has 34 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class ReportClass < Module
                          include Yast::Logger
                      
                          def main
                            textdomain "base"
                      Severity: Minor
                      Found in library/general/src/modules/Report.rb - About 4 hrs to fix

                        Method has_many has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def has_many(*relations, scope: nil, cache: false) # rubocop:disable Naming/PredicateName
                                scope = "#{scope}_" if scope
                                enable_modifications_cache if cache
                        
                                define_method "relations" do
                        Severity: Minor
                        Found in library/network/src/lib/y2firewall/firewalld/relations.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 ProgressDownload has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def ProgressDownload(percent, bps_avg, bps_current)
                              if @autorefreshing && @autorefreshing_aborted
                                Builtins.y2milestone("Refresh aborted")
                                return false
                              end
                        Severity: Minor
                        Found in library/packages/src/modules/PackageCallbacks.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

                        File susefirewall2services.rb has 341 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require "yast"
                        require "network/susefirewallservices"
                        
                        module Yast
                          # Global Definition of Firewall Services
                        Severity: Minor
                        Found in library/network/src/lib/network/susefirewall2services.rb - About 4 hrs to fix

                          Class Api has 33 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class Api
                                # This module contains specific API methods for handling zones
                                # configuration.
                                module Zones
                                  # @return [Array<String>] List of firewall zones
                          Severity: Minor
                          Found in library/network/src/lib/y2firewall/firewalld/api/zones.rb - About 4 hrs to fix

                            Method New has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def New(window_title, progress_title, length, stg, tits, help_text)
                                  stg = deep_copy(stg)
                                  tits = deep_copy(tits)
                                  return if !@visible
                            
                            
                            Severity: Major
                            Found in library/wizard/src/modules/Progress.rb - About 4 hrs to fix

                              Method ProcessSystemCommands has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def ProcessSystemCommands(command)
                                    command = deep_copy(command)
                                    # handle help for specific command
                                    # this needs to be before general help, so "help help" works
                                    if Ops.get(command, ["options", "help"])
                              Severity: Minor
                              Found in library/commandline/src/modules/CommandLine.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 ConvertToServicesDefinedByPackages has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def ConvertToServicesDefinedByPackages
                                    return if @already_converted
                              
                                    if FileUtils.Exists(@converted_to_services_dbp_file)
                                      @already_converted = true
                              Severity: Major
                              Found in library/network/src/lib/network/susefirewall2.rb - About 4 hrs to fix

                                Class ProgressClass has 32 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                  class ProgressClass < Module
                                    include Yast::Logger
                                
                                    def main
                                      Yast.import "UI"
                                Severity: Minor
                                Found in library/wizard/src/modules/Progress.rb - About 4 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language