Showing 33 of 94 total issues

Method create_product_activation has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
Open

  def create_product_activation
    activation = @system.activations.where(service_id: @product.service.id).first_or_create

    # in BYOS mode, we rely on the activation being performed in
    # `engines/scc_proxy/lib/scc_proxy/engine.rb` and don't need further checks here
Severity: Minor
Found in app/controllers/api/connect/v3/systems/products_controller.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 authenticate_system has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

  def authenticate_system(skip_on_duplicated: false)
    authenticate_or_request_with_http_basic('RMT API') do |login, password|
      @systems = System.get_by_credentials(login, password)
      if @systems.present?
        # Return now if we just detected duplicates and we were told to skip on
Severity: Minor
Found in app/controllers/application_controller.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 scc_activate_product has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

        def scc_activate_product
          logger.info "Activating product #{@product.product_string} to SCC"
          auth = request.headers['HTTP_AUTHORIZATION']
          if @system.proxy_byos
            response = SccProxy.scc_activate_product(@product, auth, params[:token], params[:email])
Severity: Minor
Found in engines/scc_proxy/lib/scc_proxy/engine.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 verify_product_activation has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

        def verify_product_activation
          product = find_product

          if product.base?
            verify_base_product_activation(product)
Severity: Minor
Found in engines/instance_verification/lib/instance_verification/engine.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 scc_deregistration has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

        def scc_deregistration
          if @system.proxy_byos
            auth = request.headers['HTTP_AUTHORIZATION']
            response = SccProxy.deregister_system_scc(auth, @system.system_token)
            unless response.code_type == Net::HTTPNoContent
Severity: Minor
Found in engines/scc_proxy/lib/scc_proxy/engine.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 create_product has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def create_product(item, root_product_id = nil, base_product = nil, recommended = false, migration_extra = false)
Severity: Minor
Found in lib/rmt/scc.rb - About 35 mins to fix

    Method prepare_scc_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def prepare_scc_request(uri_path, product, auth, token, email)
    Severity: Minor
    Found in engines/scc_proxy/lib/scc_proxy/engine.rb - About 35 mins to fix

      Method list has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
      Open

        def list
          products = (options.all ? Product.all : Product.mirrored).order(:name, :version, :arch)
          products = products.with_release_stage(options[:release_stage])
          products = products.with_name_filter(options[:name])
          products = products.with_version_filter(options[:version])
      Severity: Minor
      Found in lib/rmt/cli/products.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 announce_system has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
      Open

              def announce_system
                auth_header = nil
                auth_header = request.headers['HTTP_AUTHORIZATION'] if request.headers.include?('HTTP_AUTHORIZATION')
                system_information = hwinfo_params[:hwinfo].to_json
      
      
      Severity: Minor
      Found in engines/scc_proxy/lib/scc_proxy/engine.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 parse_package_list has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
      Open

        def parse_package_list(packagelist)
          packages = []
          hdl = File.open(packagelist.local_path, 'rb')
      
          current = {}
      Severity: Minor
      Found in lib/rmt/mirror/debian.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 import_custom_repositories has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
      Open

        def import_custom_repositories
          read_csv('enabled_custom_repos').each do |row|
            product_id, repo_name, repo_url = row
      
            repo_url += '/' unless repo_url.ends_with?('/')
      Severity: Minor
      Found in lib/rmt/cli/smt_importer.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 dispatch has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
      Open

          def dispatch(command, given_args, given_opts, config)
            handle_exceptions { super(command, given_args, given_opts, config) }
          rescue RMT::CLI::Error => e
            warn e.to_s
            if config[:shell]&.base&.options&.[]('debug')
      Severity: Minor
      Found in lib/rmt/cli/base.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 list_repositories has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
      Open

        def list_repositories(scope: :enabled)
          repositories = ((scope == :all) ? Repository.only_scc : Repository.only_scc.only_mirroring_enabled).order(:name, :description)
          decorator = ::RMT::CLI::Decorators::RepositoryDecorator.new(repositories)
      
          if repositories.empty?
      Severity: Minor
      Found in lib/rmt/cli/repos.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