Showing 7 of 36 total issues

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

    def handle_exceptions
      yield
    rescue RMT::Deduplicator::HardlinkException => e
      raise RMT::CLI::Error.new(
        _('Could not create deduplication hardlink: %{error}.') % { error: e.message },
Severity: Minor
Found in lib/rmt/cli/base.rb - About 1 hr to fix

    Method change_product has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def change_product(target, set_enabled, all_modules)
        # rubocop:disable Lint/ParenthesesAsGroupedExpression
    
        # This will return multiple products if 'SLES/15' was used
        base_products = find_products(target)
    Severity: Minor
    Found in lib/rmt/cli/products.rb - About 1 hr to fix

      Method mirror_metadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def mirror_metadata
          @downloader.repository_url = URI.join(@repository_url)
          @downloader.destination_dir = @temp_metadata_dir
          @downloader.cache_dir = @repository_dir
      
      
      Severity: Minor
      Found in lib/rmt/mirror.rb - About 1 hr to fix

        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 list has a Cognitive Complexity of 11 (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])
              decorator = ::RMT::CLI::Decorators::ProductDecorator.new(products)
          
          
          Severity: Minor
          Found in lib/rmt/cli/products.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_mirrored).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

          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

          Severity
          Category
          Status
          Source
          Language