yast/yast-registration

View on GitHub

Showing 78 of 80 total issues

Method handle_dialog has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_dialog
        ret = nil

        loop do
          ret = Yast::UI.UserInput
Severity: Minor
Found in src/lib/registration/ui/autoyast_config_dialog.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 migration_items has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def migration_items
        sorted_migrations.map.with_index do |arr, idx|
          base_product_text = base_product_text_for(arr)
          extensions_text = extensions_text_for(arr)
          modules_text = modules_text_for(arr)
Severity: Minor
Found in src/lib/registration/ui/migration_selection_dialog.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 check_repositories has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def self.check_repositories
      # only enabled repositories
      repos = Pkg.SourceGetCurrent(true)

      repos.each do |repo|
Severity: Minor
Found in src/lib/registration/sw_mgmt.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 target_distribution has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def self.target_distribution(destdir)
      if Y2Packager::MediumType.online?
        control_products = Y2Packager::ProductSpec.base_products

        target_distro = if control_products.empty?
Severity: Minor
Found in src/lib/registration/sw_mgmt.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

Method system_upgrade_check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def system_upgrade_check
        log.info "System upgrade mode detected"
        # media based upgrade requested by user
        if Yast::Linuxrc.InstallInf("MediaUpgrade") == "1"
          # we cannot do medium based upgrade using the Online medium,
Severity: Minor
Found in src/lib/registration/ui/migration_repos_workflow.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

Method run_sequence has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def run_sequence
        log.info "Restoring the original repository and registration status..."

        restore_repos

Severity: Minor
Found in src/lib/registration/ui/registration_sync_workflow.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

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

    def reg_codes_from_usb_stick
      with_tempfile("regcodes-") do |path|
        REGCODES_NAME_HANDLERS.each do |name, handler|
          next unless get_file_from_url(scheme: "usb", host: "",
                                        urlpath: "/#{name}",
Severity: Minor
Found in src/lib/registration/registration_codes_loader.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 handle_dialog has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_dialog
        loop do
          Yast::UI.SetFocus(:next)
          ui = Yast::UI.UserInput
          log.info "User input: #{ui}"
Severity: Minor
Found in src/lib/registration/ui/not_installed_products_dialog.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

Avoid deeply nested control flow statements.
Open

          return true if cert.import
Severity: Major
Found in src/lib/registration/connect_helpers.rb - About 45 mins to fix

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

        def self.online_base_product
          if Mode.update
            prods = Y2Packager::ProductSpec.base_products
            installed_names = installed_products.map { |p| p["name"] }
            prod = prods.find { |p| installed_names.include?(p.name) }
    Severity: Minor
    Found in src/lib/registration/sw_mgmt.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 handle_dialog has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def handle_dialog
            continue_buttons = [:next, :back, :abort]
    
            ret = nil
            until continue_buttons.include?(ret)
    Severity: Minor
    Found in src/lib/registration/ui/addon_reg_codes_dialog.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 update_instsys_ca has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.update_instsys_ca
          FileUtils.mkdir_p(TMP_CA_CERTS_DIR)
          # Extract system certs in openssl and pem formats
          Yast::Execute.locally("trust", "extract", "--format=openssl-directory",
            "--filter=ca-anchors", "--overwrite", File.join(TMP_CA_CERTS_DIR, "openssl"))
    Severity: Minor
    Found in src/lib/registration/ssl_certificate.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 copy_old_credentials has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.copy_old_credentials(source_dir)
          log.info "Searching registration credentials in #{source_dir}..."
    
          dir = SUSE::Connect::YaST::DEFAULT_CREDENTIALS_DIR
          # create the target directory if missing
    Severity: Minor
    Found in src/lib/registration/sw_mgmt.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 select_addons has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def select_addons(all_addons)
          # select the requested addons from the AY profile
          requested_addons.each do |addon|
            # Set architecture if it is not defined in the requested addon
            requested_arch = addon["arch"] || Yast::Arch.rpm_arch
    Severity: Minor
    Found in src/lib/registration/autoyast_addons.rb - About 35 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 get_release_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.get_release_type(product)
          if product["product_line"] && !product["product_line"].empty?
            oem_file = File.join(OEM_DIR, product["product_line"])
    
            if File.exist?(oem_file)
    Severity: Minor
    Found in src/lib/registration/sw_mgmt.rb - About 35 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 handle_dialog has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def handle_dialog
            ret = nil
    
            loop do
              refresh_buttons
    Severity: Minor
    Found in src/lib/registration/ui/autoyast_addon_dialog.rb - About 35 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 handle_registration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def handle_registration
            # do not re-register during installation
            if !Yast::Mode.normal && Registration.is_registered? &&
                Storage::InstallationOptions.instance.base_registered
    
    
    Severity: Minor
    Found in src/lib/registration/ui/base_system_registration_dialog.rb - About 35 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 set_registration_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def set_registration_url
            # set the registration URL
            url = @config.reg_server if @config.reg_server && !@config.reg_server.empty?
    
            # use SLP discovery
    Severity: Minor
    Found in src/lib/registration/clients/scc_auto.rb - About 35 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 registration_order has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def registration_order(list)
            to_process = list.dup
            result = []
    
            loop do
    Severity: Minor
    Found in src/lib/registration/addon.rb - About 35 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 merge_registered_addons has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def merge_registered_addons
            return unless load_addons
    
            # TRANSLATORS: Popup question, merge this addon that are registered but not
            # installed to the current migration products list.
    Severity: Minor
    Found in src/lib/registration/ui/migration_repos_workflow.rb - About 35 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