yast/yast-installation

View on GitHub
src/lib/installation/clients/inst_extrasources.rb

Summary

Maintainability
D
2 days
Test Coverage

Method main has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

    def main
      textdomain "installation"

      # local sources that have been attached under /mnt during upgrade
      @local_urls = {}
Severity: Minor
Found in src/lib/installation/clients/inst_extrasources.rb - About 7 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 inst_extrasources.rb has 369 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "y2packager/known_repositories"
require "y2packager/resolvable"

Yast.import "UI"
Yast.import "Pkg"
Severity: Minor
Found in src/lib/installation/clients/inst_extrasources.rb - About 4 hrs to fix

    Method RegisterRepos has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def RegisterRepos(url_list)
          url_list = deep_copy(url_list)
          ret = []
    
          Builtins.foreach(url_list) do |new_url|
    Severity: Minor
    Found in src/lib/installation/clients/inst_extrasources.rb - About 1 hr 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 RegisteredUrls has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def RegisteredUrls
          # get all registered installation sources
          srcs = Pkg.SourceGetCurrent(false)
    
          result = srcs.each_with_object([]) do |src, ret|
    Severity: Minor
    Found in src/lib/installation/clients/inst_extrasources.rb - About 1 hr 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 UpgradesAvailable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def UpgradesAvailable(repos)
          ret = []
          packages = []
    
          # only package names (without version)
    Severity: Minor
    Found in src/lib/installation/clients/inst_extrasources.rb - About 55 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

    Avoid deeply nested control flow statements.
    Open

                  if Ops.greater_than(Builtins.size(@check_repos), 0)
                    UpgradeFrom(@check_repos)
    
                    @upgrade_info = UpgradesAvailable(@check_repos)
                    @upgrade_repos = Ops.get_list(@upgrade_info, "repositories", [])
    Severity: Major
    Found in src/lib/installation/clients/inst_extrasources.rb - About 45 mins to fix

      Method InstallPackages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def InstallPackages(msg, details)
            button_box = ButtonBox(
              PushButton(
                Id(:yes),
                Opt(:default, :okButton, :key_F10),
      Severity: Minor
      Found in src/lib/installation/clients/inst_extrasources.rb - About 45 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 GetURLsToRegister has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def GetURLsToRegister(registered)
            urls_from_control_file = ProductFeatures.GetFeature("software", "extra_urls")
      
            if urls_from_control_file.nil?
              Builtins.y2milestone(
      Severity: Minor
      Found in src/lib/installation/clients/inst_extrasources.rb - About 45 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

      There are no issues that match your filters.

      Category
      Status