yast/yast-yast2

View on GitHub

Showing 967 of 967 total issues

Avoid too many return statements within this method.
Open

          return false
Severity: Major
Found in library/commandline/src/modules/CommandLine.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return false
    Severity: Major
    Found in library/control/src/modules/WorkflowManager.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return true if private_network?(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.0.2.")
        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?("198.51.100.")
          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 false if !Builtins.regexpmatch(Ops.get_string(tokens, "port", ""), "^[0-9]*$")
            Severity: Major
            Found in library/types/src/modules/URL.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?("203.0.113.")
                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

                    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 ip.start_with?("192.19.")
                      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 (224..255).cover?(ip.split(".").first.to_i)
                        Severity: Major
                        Found in library/types/src/modules/IP.rb - About 30 mins to fix

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              def AnyQuestion(headline, message, yes_button_message, no_button_message, focus)
                                button_box = AnyQuestionButtonBox(
                                  yes_button_message,
                                  no_button_message,
                                  focus
                          Severity: Minor
                          Found in library/general/src/modules/Popup.rb and 1 other location - About 25 mins to fix
                          library/general/src/modules/Popup.rb on lines 335..357

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 31.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              def SetStartService(start_service)
                                if !SuSEFirewallIsSelectedOrInstalled()
                                  Builtins.y2warning("Cannot set SetStartService")
                                  return nil
                                end
                          Severity: Minor
                          Found in library/network/src/lib/network/susefirewall.rb and 1 other location - About 25 mins to fix
                          library/network/src/lib/network/susefirewall.rb on lines 100..120

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 31.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              def ErrorAnyQuestion(headline, message, yes_button_message, no_button_message, focus)
                                button_box = AnyQuestionButtonBox(
                                  yes_button_message,
                                  no_button_message,
                                  focus
                          Severity: Minor
                          Found in library/general/src/modules/Popup.rb and 1 other location - About 25 mins to fix
                          library/general/src/modules/Popup.rb on lines 289..311

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 31.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              def SetEnableService(enable_service)
                                if !SuSEFirewallIsSelectedOrInstalled()
                                  Builtins.y2warning("Cannot set SetEnableService")
                                  return nil
                                end
                          Severity: Minor
                          Found in library/network/src/lib/network/susefirewall.rb and 1 other location - About 25 mins to fix
                          library/network/src/lib/network/susefirewall.rb on lines 63..83

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 31.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          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 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 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 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

                          Severity
                          Category
                          Status
                          Source
                          Language