yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

Avoid too many return statements within this method.
Open

      return true if ip.start_with?("192.18.")
Severity: Major
Found in library/types/src/modules/IP.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return true if ds_lite_address?(ip)
    Severity: Major
    Found in library/types/src/modules/IP.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return true if ip.start_with?("192.88.99.")
      Severity: Major
      Found in library/types/src/modules/IP.rb - About 30 mins to fix

        Method parseKeys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def parseKeys(input)
              # NOTE: see /usr/share/doc/packages/gpg/DETAILS for another way
        
              ret = []
              lines = Builtins.splitstring(input, "\n")
        Severity: Minor
        Found in library/gpg/src/modules/GPG.rb - About 25 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 from_methods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def from_methods(sequence_hash)
              sequence_hash.keys.map do |name|
                next nil if name == START
        
                if self.class.skip_stack?(name)
        Severity: Minor
        Found in library/sequencer/src/lib/ui/sequence.rb - About 25 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 GetTypeFromSysfs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def GetTypeFromSysfs(dev)
              sys_dir_path = Builtins.sformat("/sys/class/net/%1", dev)
              sys_type_path = Builtins.sformat("%1/type", sys_dir_path)
        
              return nil if IsEmpty(dev) || !FileUtils.Exists(sys_type_path)
        Severity: Minor
        Found in library/network/src/modules/NetworkInterfaces.rb - About 25 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 CreateTreeInternal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def CreateTreeInternal(tree, parent)
              tree = deep_copy(tree)
              m = Builtins.filter(tree) do |c|
                Ops.get_string(c, "parent", "") == parent
              end
        Severity: Minor
        Found in library/wizard/src/modules/Wizard.rb - About 25 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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(xml, schema)
              xml = SCR.Read(path(".target.string"), xml.to_s) if xml.is_a?(Pathname)
              if schema.is_a?(::String)
                validator = Nokogiri::XML::RelaxNG(schema)
              else
        Severity: Minor
        Found in library/xml/src/modules/XML.rb - About 25 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 create_snapshot? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def create_snapshot?(snapshot_type)
                disable_snapshots = Yast::Linuxrc.value_for(Yast::LinuxrcClass::DISABLE_SNAPSHOTS)
        
                # Feature is not defined on Linuxrc commandline
                return true if disable_snapshots.nil? || disable_snapshots.empty?
        Severity: Minor
        Found in library/system/src/lib/yast2/fs_snapshot.rb - About 25 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 memory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.memory
              memory = Yast::SCR.Read(Yast::Path.new(".probe.memory"))
              log.debug("hwinfo memory: #{memory}")
        
              raise "Memory detection failed" unless memory
        Severity: Minor
        Found in library/system/src/lib/yast2/hw_detection.rb - About 25 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 CanonicalizeIP has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def CanonicalizeIP(ifcfg)
              ifcfg = deep_copy(ifcfg)
              return nil if ifcfg.nil?
        
              ipaddr, prefixlen = ifcfg["IPADDR"].to_s.split("/")
        Severity: Minor
        Found in library/network/src/modules/NetworkInterfaces.rb - About 25 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 SetContentsButtons has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def SetContentsButtons(title, contents, help_text, back_label, next_label)
              contents = deep_copy(contents)
              UI.PostponeShortcutCheck
        
              RestoreBackButton()
        Severity: Minor
        Found in library/wizard/src/modules/Wizard.rb - About 25 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 detect_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def detect_type(text, children, node)
              # backward compatibility. Newly maps should have its type
              if text.empty? && !children.empty?
                "map"
              elsif (!text.empty? && children.empty?) ||
        Severity: Minor
        Found in library/xml/src/modules/XML.rb - About 25 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 CheckFiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def CheckFiles(files)
              files = deep_copy(files)
              files = Builtins.filter(files) { |f| FileChanged(f) }
        
              return true unless Ops.greater_than(Builtins.size(files), 0)
        Severity: Minor
        Found in library/system/src/modules/FileChanges.rb - About 25 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 ShowReleaseNotesButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def ShowReleaseNotesButton(label, id)
              # has wizard? continue
              #   otherwise use dedicated ReplacePoint or reuse the back button
              # show-releasenotes-button failed? continue
              #   use dedicated ReplacePoint or reuse the back button
        Severity: Minor
        Found in library/wizard/src/modules/Wizard.rb - About 25 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 prepareVendorDeviceInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def prepareVendorDeviceInfo(controller)
              controller = deep_copy(controller)
              # build up vendor/device information
        
              # if vendor not given, try sub_vendor
        Severity: Minor
        Found in library/system/src/modules/ModuleLoading.rb - About 25 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 Save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def Save(force)
              # make module names to one long string
              # start with modules from linuxrc
        
              # write module options to modules.conf, mk_initrd handles the rest
        Severity: Minor
        Found in library/system/src/modules/ModulesConf.rb - About 25 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 CreateNewPortRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def CreateNewPortRange(min_pr, max_pr)
              if min_pr.nil? || min_pr == 0
                Builtins.y2error(
                  "Wrong definition of the starting port '%1', it must be between 1 and 65535",
                  min_pr
        Severity: Minor
        Found in library/network/src/modules/PortRanges.rb - About 25 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 GetListOfForwardsIntoMasquerade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def GetListOfForwardsIntoMasquerade
              list_of_rules = []
        
              Builtins.foreach(
                Builtins.splitstring(
        Severity: Minor
        Found in library/network/src/lib/network/susefirewall2.rb - About 25 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 enable_modifications_cache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def enable_modifications_cache
                # Return an array with all the modified attributes/relations
                define_method "modified" do
                  @modified ||= []
                end
        Severity: Minor
        Found in library/network/src/lib/y2firewall/firewalld/relations.rb - About 25 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