yast/yast-registration

View on GitHub

Showing 78 of 80 total issues

Method start_workflow has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def start_workflow
      sequence = {
        "ws_start"               => workflow_start,
        "check"                  => {
          auto:       :auto,
Severity: Major
Found in src/lib/registration/clients/inst_scc.rb - About 2 hrs to fix

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

        def self.reg_url_at_upgrade
          # in online upgrade mode behave like in installed system
          return reg_url_at_running_system if Yast::Installation.destdir == "/"
    
          custom_url = ::Registration::Storage::InstallationOptions.instance.custom_url
    Severity: Minor
    Found in src/lib/registration/url_helpers.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 registration_check has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def registration_check
          # Go back if the user clicked 'back' in the registration dialog
          return :back if @back_from_register
    
          # check the base product at start to avoid problems later,
    Severity: Minor
    Found in src/lib/registration/clients/inst_scc.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 add_service has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.add_service(product_service, credentials)
          # save repositories before refreshing added services (otherwise
          # pkg-bindings will treat them as removed by the service refresh and
          # unload them)
          if !Pkg.SourceSaveAll
    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 write has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def write
            # registration disabled, nothing to do
            return true if !@config.do_registration && !Yast::Mode.update
    
            # initialize libzypp if applying settings in installed system or
    Severity: Minor
    Found in src/lib/registration/clients/scc_auto.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 content_server_settings has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def content_server_settings
            sha1   = ::Registration::Fingerprint::SHA1
            sha256 = ::Registration::Fingerprint::SHA256
            fingerprint_type = (config.reg_server_cert_fingerprint_type || "").upcase
    
    
    Severity: Minor
    Found in src/lib/registration/ui/autoyast_config_dialog.rb - About 1 hr to fix

      Method add_service has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.add_service(product_service, credentials)
            # save repositories before refreshing added services (otherwise
            # pkg-bindings will treat them as removed by the service refresh and
            # unload them)
            if !Pkg.SourceSaveAll
      Severity: Minor
      Found in src/lib/registration/sw_mgmt.rb - About 1 hr to fix

        Method run has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def run
                aliases = {
                  "find_products"       => [->() { find_products }, true],
                  "register_base"       => ->() { register_base },
                  "load_remote_addons"  => ->() { load_remote_addons },
        Severity: Minor
        Found in src/lib/registration/ui/media_addon_workflow.rb - About 1 hr to fix

          Method handle_user_input has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                def handle_user_input
                  loop do
                    ret = Yast::UI.UserInput
          
                    case ret
          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 download_file has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.download_file(file_url, insecure: false, redirection_count: 10)
                raise DownloadError,
                  "Redirection not allowed or limit has been reached" if redirection_count < 0
          
                file_url = URI(file_url) unless file_url.is_a?(URI)
          Severity: Minor
          Found in src/lib/registration/downloader.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 registration_check has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def registration_check
                # Go back if the user clicked 'back' in the registration dialog
                return :back if @back_from_register
          
                # check the base product at start to avoid problems later,
          Severity: Minor
          Found in src/lib/registration/clients/inst_scc.rb - About 1 hr to fix

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

                  def run
                    Yast::Wizard.SetContents(
                      # dialog title
                      _("License Agreement"),
                      Label(_("Downloading Licenses...")),
            Severity: Minor
            Found in src/lib/registration/ui/addon_eula_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 find_base_product has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.find_base_product
                  # FIXME: refactor the code to use Y2Packager::Product
            
                  # just for debugging:
                  return FAKE_BASE_PRODUCT if ENV["FAKE_BASE_PRODUCT"]
            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 run has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def run
                    aliases = {
                      "general"         => ->() { configure_registration },
                      "addons"          => [->() { select_addons }, true],
                      "remote_addons"   => [->() { select_remote_addons }, true],
            Severity: Minor
            Found in src/lib/registration/ui/autoyast_config_workflow.rb - About 1 hr to fix

              Method richtext_checkbox has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def richtext_checkbox(id:, label:, status:)
                      enabled = [:selected, :auto_selected, :available].include?(status)
                      if Yast::UI.TextMode
                        check = case status
                        when :selected, :registered
              Severity: Minor
              Found in src/lib/registration/ui/addon_selection_base_dialog.rb - About 1 hr to fix

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

                    def main
                      textdomain "registration"
                
                      if WFM.Args.include?("help")
                        print_help
                Severity: Minor
                Found in src/clients/scc.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 init has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.init(load_packages = false)
                      # false = do not allow continuing without the libzypp lock
                      lock = PackageLock.Connect(false)
                      # User would like to abort
                      raise_pkg_exception(PkgAborted) if lock["aborted"]
                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 handle_dialog has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                      def handle_dialog
                        Yast::UI.SetFocus(Id(:items))
                
                        ret = nil
                        continue_buttons = [:next, :back, :abort, :skip]
                Severity: Minor
                Found in src/lib/registration/ui/addon_selection_base_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 handle_ssl_error has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def self.handle_ssl_error(error, certificate_imported)
                      cert = Storage::SSLErrors.instance.ssl_failed_cert
                      error_code = Storage::SSLErrors.instance.ssl_error_code
                      expected_cert_type = Storage::Config.instance.reg_server_cert_fingerprint_type
                
                
                Severity: Minor
                Found in src/lib/registration/connect_helpers.rb - About 1 hr to fix

                  Method download_file has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def self.download_file(file_url, insecure: false, redirection_count: 10)
                        raise DownloadError,
                          "Redirection not allowed or limit has been reached" if redirection_count < 0
                  
                        file_url = URI(file_url) unless file_url.is_a?(URI)
                  Severity: Minor
                  Found in src/lib/registration/downloader.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language