yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

Method CreateHelp has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def CreateHelp(logs, parameters)
      parameters = deep_copy(parameters)
      help = Ops.get_string(parameters, "help", "")
      return help if help != "" && !help.nil?

Severity: Minor
Found in library/log/src/modules/LogView.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 parse_zones has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_zones
        current_zone = nil
        current_attribute = nil
        zones_definition.each_with_object(zone_entries) do |line, entries|
          next if line.lstrip.empty?
Severity: Minor
Found in library/network/src/lib/y2firewall/firewalld/zone_reader.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 read has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def read(name)
        info = Y2Firewall::Firewalld.instance.api.info_service(name)
        raise(Service::NotFound, name) if $CHILD_STATUS.exitstatus == 101

        service = Service.new(name: name)
Severity: Minor
Found in library/network/src/lib/y2firewall/firewalld/service_reader.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 ChooseItem has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def ChooseItem(_title, items, selected)
      items = deep_copy(items)
      item = nil

      items = Builtins.maplist(items) do |i|
Severity: Minor
Found in library/network/src/modules/NetworkPopup.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 FindBaseProducts has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def FindBaseProducts
      return unless load_zypp

      log.info "Looking for base products"

Severity: Minor
Found in library/packages/src/modules/Product.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 all_products has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def all_products(force_repos: false)
      linuxrc_special_products = if Yast::Linuxrc.InstallInf("specialproduct")
        linuxrc_string(Yast::Linuxrc.InstallInf("specialproduct")).split(",")
      else
        []
Severity: Minor
Found in library/packages/src/lib/y2packager/product_reader.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 FormatFilename has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def FormatFilename(file_path, len)
      return nil unless file_path
      return file_path if len && len > file_path.size

      dir = file_path.split("/", -1)
Severity: Minor
Found in library/types/src/modules/String.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 GetAllKnownInterfaces has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def GetAllKnownInterfaces
      known_interfaces = []

      # All dial-up interfaces
      dialup_interfaces = NetworkInterfaces.List("dialup")
Severity: Major
Found in library/network/src/lib/network/susefirewall.rb - About 2 hrs to fix

    Method main has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def main
          Yast.import "Pkg"
          Yast.import "UI"
    
          textdomain "base"
    Severity: Major
    Found in library/packages/src/modules/PackageCallbacks.rb - About 2 hrs to fix

      Method UseItemWithNoChecksum has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method Run has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def Run(settings)
              settings = deep_copy(settings)
              screens = Ops.get_map(settings, "screens", {})
              widget_descr = Ops.get_map(settings, "widget_descr", {})
              initial_screen = Ops.get_string(settings, "initial_screen", "")
        Severity: Major
        Found in library/cwm/src/modules/DialogTree.rb - About 2 hrs to fix

          File AsciiFile.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "yast"
          
          module Yast
            # Assume this /etc/fstab file
            #
          Severity: Minor
          Found in library/general/src/modules/AsciiFile.rb - About 2 hrs to fix

            Method MergeProposal has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def MergeProposal(base, additional_control, prod_name, domain)
                  base = deep_copy(base)
                  additional_control = deep_copy(additional_control)
                  # Additional proposal settings - Replacing items
                  replaces = Builtins.listmap(
            Severity: Minor
            Found in library/control/src/modules/WorkflowManager.rb - About 2 hrs to fix

              Method ScriptStart has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def ScriptStart(patch_name, patch_version, patch_arch, script_path)
                    patch_full_name = FormatPatchName(patch_name, patch_version, patch_arch)
              
                    Builtins.y2milestone(
                      "ScriptStart callback: patch: %1, script: %2",
              Severity: Minor
              Found in library/packages/src/modules/PackageCallbacks.rb - About 1 hr to fix

                Method Authentication has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def Authentication(url, msg, username, password)
                      # FIXME: after SLE12 release
                      # The following 'if' block is a workaround for bnc#895719 that should be
                      # extracted to a proper private method (not sure if it will work as
                      # expected being a callback) and adapted to use normal _() instead of
                Severity: Minor
                Found in library/packages/src/modules/PackageCallbacks.rb - About 1 hr to fix

                  Method getProposals has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def getProposals(stage, mode, proptype)
                        props = getMatchingProposal(stage, mode, proptype)
                        unique_id = Ops.get_string(props, [0, "unique_id"], "")
                        disabled_subprops = GetDisabledSubProposals()
                  
                  
                  Severity: Minor
                  Found in library/control/src/modules/ProductControl.rb - About 1 hr to fix

                    Method DocodeDomainNames has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def DocodeDomainNames(encoded_domain_names)
                          encoded_domain_names = deep_copy(encoded_domain_names)
                          decoded_domain_names = []
                          strings_to_decode = []
                    
                    
                    Severity: Minor
                    Found in library/types/src/modules/Punycode.rb - About 1 hr to fix

                      Method Run has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def Run(aliases, sequence)
                            aliases = deep_copy(aliases)
                            sequence = deep_copy(sequence)
                            # Check aliases and sequence correctness
                            return Convert.to_symbol(WS_error("CHECK FAILED")) if @docheck && WS_check(aliases, sequence) != true
                      Severity: Minor
                      Found in library/sequencer/src/modules/Sequencer.rb - About 1 hr to fix

                        Method ProgressDownload has 48 lines of code (exceeds 25 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 1 hr to fix

                          Method Run has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def Run(widgets, functions, skip_store_for: [])
                                widgets = deep_copy(widgets)
                                functions = deep_copy(functions)
                                widgets = mergeFunctions(widgets, functions)
                                PushSettings()
                          Severity: Minor
                          Found in library/cwm/src/modules/CWM.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language