yast/yast-yast2

View on GitHub

Showing 967 of 967 total issues

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

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

    def remove_port(port_or_range, protocol, interface)
      return false unless valid_port?(port_or_range)
      return false unless supported_protocol?(protocol)

      zone = interface_zone(interface)
Severity: Minor
Found in library/network/src/modules/firewalld_wrapper.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 AnyRPCServiceInConfiguration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def AnyRPCServiceInConfiguration
      ret = false

      Builtins.foreach(GetKnownFirewallZones()) do |fw_zone|
        fw_rule = Builtins.sformat("FW_SERVICES_%1_RPC", fw_zone)
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 EnableDisableNow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def EnableDisableNow(force: false)
      return unless force || Modified()

      if current_name && Modified()
        stop_service(current_name)
Severity: Minor
Found in library/network/src/modules/NetworkService.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 apply_changes! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def apply_changes!
        return true unless modified?

        apply_relations_changes!
        apply_attributes_changes!
Severity: Minor
Found in library/network/src/lib/y2firewall/firewalld/zone.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 AskPackageKit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def AskPackageKit
      ret = false

      if PackageKit.IsRunning
        # ask to send quit signal to PackageKit
Severity: Minor
Found in library/packages/src/modules/PackageLock.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 add_port has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add_port(port_or_range, protocol, interface)
      return false unless valid_port?(port_or_range)
      return false unless supported_protocol?(protocol)

      zone = interface_zone(interface)
Severity: Minor
Found in library/network/src/modules/firewalld_wrapper.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 ArePortsOrServicesAllowed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def ArePortsOrServicesAllowed(needed_ports, protocol, zone, check_for_aliases)
      needed_ports = deep_copy(needed_ports)
      are_allowed = true

      if Ops.less_than(Builtins.size(needed_ports), 1)
Severity: Minor
Found in library/network/src/lib/network/susefirewall.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