yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

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

    def SetServicesForZones(services_ids, firewall_zones, new_status)
      Yast.import "SuSEFirewallServices"

      services_ids = deep_copy(services_ids)
      zones = deep_copy(firewall_zones)
Severity: Minor
Found in library/network/src/lib/network/susefirewalld.rb - About 2 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 ShowInstallationSummaryMap has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def ShowInstallationSummaryMap(summary)
      summary_str = InstallationSummary(summary)

      if summary["installed"] == 0 && summary["updated"] == 0 && summary["removed"] == 0 && summary["remaining"] == []
        Builtins.y2warning("No summary, skipping summary dialog")
Severity: Minor
Found in library/packages/src/modules/PackagesUI.rb - About 2 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 PackageDialog has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def PackageDialog(packages, install, message)
      log.info "Asking for packages: #{packages}"
      packs = Builtins.filter(packages) do |package|
        install ? !Installed(package) : Installed(package)
      end
Severity: Minor
Found in library/packages/src/modules/Package.rb - About 2 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 ReadFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def ReadFile(file, pathname)
      Builtins.y2milestone("path=%1", pathname)
      lines = []
      if Ops.greater_than(SCR.Read(path(".target.size"), pathname), 0)
        value = Convert.to_string(SCR.Read(path(".target.string"), pathname))
Severity: Minor
Found in library/general/src/modules/AsciiFile.rb - About 2 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 Detection has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def Detection(class_, icon_name)
      Builtins.y2warning(-1, "Parameter 'icon_name' is deprecated.") if !icon_name.nil?

      return true if Linuxrc.manual != true

Severity: Major
Found in library/wizard/src/modules/Confirm.rb - About 2 hrs to fix

    Method ErrorScanDb has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def ErrorScanDb(error, description)
          Builtins.y2error(
            "ErrorScanDb callback: error: %1, description: %2",
            error,
            description
    Severity: Major
    Found in library/packages/src/modules/PackageCallbacks.rb - About 2 hrs to fix

      Method Summary has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def Summary
            summary = ""
            # translators: summary header for messages generated through autoinstallation
            summary = Summary.AddHeader(summary, _("Messages"))
            summary = Summary.OpenList(summary)
      Severity: Major
      Found in library/general/src/modules/Report.rb - About 2 hrs to fix

        File FileUtils.rb has 273 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "yast"
        require "shellwords"
        
        module Yast
          class FileUtilsClass < Module
        Severity: Minor
        Found in library/general/src/modules/FileUtils.rb - About 2 hrs to fix

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

              def Start(widget, data)
                widget = deep_copy(widget)
                data = deep_copy(data)
                if !@id.nil?
                  SCR.Execute(path(".process.release"), @id)
          Severity: Major
          Found in library/log/src/modules/LogViewCore.rb - About 2 hrs to fix

            Method CreateWidget has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def CreateWidget(settings)
                  settings = deep_copy(settings)
                  tab_order = Ops.get_list(settings, "tab_order", [])
                  tabs = Ops.get_map(settings, "tabs", {})
                  initial_tab = Ops.get_string(settings, "initial_tab", "")
            Severity: Major
            Found in library/cwm/src/modules/CWMTab.rb - About 2 hrs to fix

              Class Firewalld has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Firewalld
                  include Singleton
                  include Yast::Logger
                  extend Forwardable
                  extend Relations
              Severity: Minor
              Found in library/network/src/lib/y2firewall/firewalld.rb - About 2 hrs to fix

                Class AbstractWidget has 23 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class AbstractWidget
                    include Yast::UIShortcuts
                    include Yast::I18n
                    include Yast::Logger
                
                
                Severity: Minor
                Found in library/cwm/src/lib/cwm/abstract_widget.rb - About 2 hrs to fix

                  Class CWMTabClass has 23 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class CWMTabClass < Module
                      def main
                        Yast.import "UI"
                        textdomain "base"
                  
                  
                  Severity: Minor
                  Found in library/cwm/src/modules/CWMTab.rb - About 2 hrs to fix

                    Class CompoundService has 23 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class CompoundService
                        include Yast::Logger
                    
                        # Managed services
                        #
                    Severity: Minor
                    Found in library/systemd/src/lib/yast2/compound_service.rb - About 2 hrs to fix

                      Class IPClass has 23 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class IPClass < Module
                          include Yast::Logger
                      
                          def main
                            textdomain "base"
                      Severity: Minor
                      Found in library/types/src/modules/IP.rb - About 2 hrs to fix

                        Method SetNeededPortsAndProtocols has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def SetNeededPortsAndProtocols(service, store_definition)
                              if !IsKnownService(service)
                                log.error "Service #{service} is unknown"
                                raise(
                                  SuSEFirewalServiceNotFound,
                        Severity: Major
                        Found in library/network/src/lib/network/susefirewall2services.rb - About 2 hrs to fix

                          Method RunPatternSelector has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def RunPatternSelector(enable_back: false, cancel_label: Label.CancelButton)
                                Builtins.y2milestone("Running pattern selection dialog")
                          
                                if !UI.HasSpecialWidget(:PatternSelector) ||
                                    UI.WizardCommand(term(:Ping)) != true
                          Severity: Major
                          Found in library/packages/src/modules/PackagesUI.rb - About 2 hrs to fix

                            Method board_compatible has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def board_compatible
                                  if @_board_compatible.nil?
                                    @_checkgeneration = ""
                                    systemProbe = Convert.convert(
                                      SCR.Read(path(".probe.system")),
                            Severity: Major
                            Found in library/general/src/modules/Arch.rb - About 2 hrs to fix

                              Method WriteConfiguration has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def WriteConfiguration
                                    # just disabled
                                    return true if !SuSEFirewallIsInstalled()
                              
                                    return false if !GetModified()
                              Severity: Minor
                              Found in library/network/src/lib/network/susefirewalld.rb - About 2 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 Import has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def Import(import_settings)
                                    Read()
                                    import_settings = deep_copy(import_settings || {})
                                    # Sanitize it
                                    import_settings.each_key do |k|
                              Severity: Minor
                              Found in library/network/src/lib/network/susefirewalld.rb - About 2 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

                              Severity
                              Category
                              Status
                              Source
                              Language