yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

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

    def InstallationSummary(summary)
      ret = ""

      if Builtins.haskey(summary, "success")
        ret = HTML.Para(
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 ReplaceProposalModule has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def ReplaceProposalModule(proposal, old, new)
      proposal = deep_copy(proposal)
      new = deep_copy(new)
      found = false

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

    def TableHandle(descr, key, event_descr)
      descr = deep_copy(descr)
      event_descr = deep_copy(event_descr)
      event_id = Ops.get(event_descr, "ID")
      attrib = Ops.get_map(descr, "_cwm_attrib", {})
Severity: Minor
Found in library/cwm/src/modules/CWMTable.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 ConvertBackAndForth has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def ConvertBackAndForth(strings_in, to_punycode)
      # Some (or maybe all) strings needn't be cached
      not_cached = []

      # Check the cache for already entered strings
Severity: Minor
Found in library/types/src/modules/Punycode.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

File Initrd.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"
require "shellwords"

module Yast
  class InitrdClass < Module
Severity: Minor
Found in library/system/src/modules/Initrd.rb - About 2 hrs to fix

    Method Write has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def Write
          Read() if !(@was_read || Mode.config)
          Update() if Mode.update
          Builtins.y2milestone(
            "Initrd::Write called, changed: %1, list: %2",
    Severity: Major
    Found in library/system/src/modules/Initrd.rb - About 2 hrs to fix

      Method GetSlideList has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def GetSlideList(lang)
            slide_list = nil
      
            txt_path = Builtins.sformat("%1/txt/%2", @slide_base_path, lang)
            if FileUtils.Exists(txt_path)
      Severity: Major
      Found in library/packages/src/modules/Slides.rb - About 2 hrs to fix

        Class Url has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Url < Base
              class << self
                # Enable downloading release notes
                #
                # This method is intended to be used during testing.
        Severity: Minor
        Found in library/packages/src/lib/y2packager/release_notes_fetchers/url.rb - About 2 hrs to fix

          Class ModeClass has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class ModeClass < Module
              def main
                textdomain "base"
          
                # Current mode
          Severity: Minor
          Found in library/general/src/modules/Mode.rb - About 2 hrs to fix

            Class FileUtilsClass has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class FileUtilsClass < Module
                def main
                  textdomain "base"
                  Yast.import "Popup"
                  Yast.import "String"
            Severity: Minor
            Found in library/general/src/modules/FileUtils.rb - About 2 hrs to fix

              Method WriteConfiguration has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def WriteConfiguration
                    # just disabled
                    return true if !SuSEFirewallIsInstalled()
              
                    # Progress only for normal configuration and command line
              Severity: Major
              Found in library/network/src/lib/network/susefirewall2.rb - About 2 hrs to fix

                Method ReadFile has 58 lines of code (exceeds 25 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: Major
                Found in library/general/src/modules/AsciiFile.rb - About 2 hrs to fix

                  Method ItemSignedWithPublicSignature has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def ItemSignedWithPublicSignature(item_type, item_name, key)
                        key = deep_copy(key)
                        description_text = Builtins.sformat(
                          if item_type == :package
                            # popup question, %1 stands for the package name, %2 for the key ID, %3 for the key name
                  Severity: Major
                  Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 2 hrs to fix

                    Method ParseSingleDesktopFile has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def ParseSingleDesktopFile(file)
                          filename = Builtins.sformat("%1/%2.desktop", Directory.desktopdir, file)
                          # Do not use .yast2.desktop.v.$filename, because ini-agent reads
                          # all the desktop files anyway which is wasteful for setting one icon.
                          # The config is adapted from .yast2.desktop.
                    Severity: Major
                    Found in library/desktop/src/modules/Desktop.rb - About 2 hrs to fix

                      Method Write has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def Write
                            Read() if !(@was_read || Mode.config)
                            Update() if Mode.update
                            Builtins.y2milestone(
                              "Initrd::Write called, changed: %1, list: %2",
                      Severity: Minor
                      Found in library/system/src/modules/Initrd.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 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def PackageDialog(packages, install, message)
                            packages = deep_copy(packages)
                            Builtins.y2debug("Asking for packages: %1", packages)
                            packs = Builtins.filter(packages) do |package|
                              install ? !Installed(package) : Installed(package)
                      Severity: Minor
                      Found in library/packages/src/include/packages/common.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 ReadConfig has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def ReadConfig(config)
                            Builtins.y2debug("config=%1", config)
                            return {} if config.nil?
                      
                            ret = {}
                      Severity: Minor
                      Found in library/network/src/modules/NetworkConfig.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 IsValidPortRange has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def IsValidPortRange(port_range)
                            # not a port range
                            if !IsPortRange(port_range)
                              warning = Builtins.sformat("Not a port-range %1", port_range)
                              Builtins.y2milestone(warning) if ReportOnlyOnce(warning)
                      Severity: Minor
                      Found in library/network/src/modules/PortRanges.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 control_file has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def control_file(source)
                            package = case source
                            when ::Integer
                              product = find_product(source)
                              return nil unless product&.product_package
                      Severity: Minor
                      Found in library/control/src/modules/WorkflowManager.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 load_file_locale has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def load_file_locale(patterns, file_path, language)
                            patterns = deep_copy(patterns)
                            i = 0
                            while Ops.less_than(i, Builtins.size(patterns))
                              p = Ops.get(patterns, i, "")
                      Severity: Minor
                      Found in library/general/src/modules/CustomDialogs.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