ManageIQ/multi_repo

View on GitHub

Showing 20 of 35 total issues

Class Github has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Github
    def self.api_token
      @api_token ||= ENV["GITHUB_API_TOKEN"]
    end

Severity: Minor
Found in lib/multi_repo/service/github.rb - About 3 hrs to fix

    Method request has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def request(verb, path, body: nil, headers: {}, verbose: true)
          path = File.join(registry, path)
    
          headers = default_headers.merge(headers) if default_headers
    
    
    Severity: Minor
    Found in lib/multi_repo/service/docker.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

    Class GitMirror has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class GitMirror
        def initialize
          require "colorize"
          require "config"
          require "fileutils"
    Severity: Minor
    Found in lib/multi_repo/helpers/git_mirror.rb - About 2 hrs to fix

      Class Docker has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Docker
          def self.registry
            @registry ||= ENV.fetch("DOCKER_REGISTRY")
          end
      
      
      Severity: Minor
      Found in lib/multi_repo/service/docker.rb - About 2 hrs to fix

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

            def blast
              repo.git.fetch
        
              unless repo.git.remote_branch?("origin", base)
                puts "!! Skipping #{repo.name}: 'origin/#{base}' not found".light_yellow
        Severity: Minor
        Found in lib/multi_repo/helpers/pull_request_blaster_outer.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 request has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def request(verb, path, body: nil, headers: nil, verbose: true)
              headers ||= self.class.auth_header.merge(
                "Accept"       => "application/json",
                "Content-Type" => "application/json"
              )
        Severity: Minor
        Found in lib/multi_repo/service/artifactory.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 blast has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def blast
              repo.git.fetch
        
              unless repo.git.remote_branch?("origin", base)
                puts "!! Skipping #{repo.name}: 'origin/#{base}' not found".light_yellow
        Severity: Minor
        Found in lib/multi_repo/helpers/pull_request_blaster_outer.rb - About 1 hr to fix

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

              def sync_branch(source_remote, source_name, dest_remote, dest_name)
                return unless dest_remote && dest_name
          
                source_fq_name = "#{source_remote}/#{source_name}"
                dest_fq_name   = "#{dest_remote}/#{dest_name}"
          Severity: Minor
          Found in lib/multi_repo/helpers/git_mirror.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 clone_repo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def clone_repo(upstream_repo, downstream_repo, path, remote_source)
                upstream_remote = settings.git_mirror.remotes[remote_source]
                raise "remote '#{remote_source}'' not found in settings" if upstream_remote.nil?
          
                system("git clone #{upstream_remote}/#{upstream_repo}.git #{path} -o upstream")
          Severity: Minor
          Found in lib/multi_repo/helpers/git_mirror.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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def run
                if stub_exists?
                  puts "A stub gem for #{repo.inspect} already exists."
                  return
                end
          Severity: Minor
          Found in lib/multi_repo/service/rubygems_stub.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 client has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.client(path:, clone_source:)
                require "minigit"
                require_relative "git/minigit_capturing_patch"
          
                retried = false
          Severity: Minor
          Found in lib/multi_repo/service/git.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 repos_for has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.repos_for(repo: nil, repo_set: nil, dry_run: false, **_)
                Optimist.die("options --repo or --repo_set must be specified") unless repo || repo_set
          
                if repo_set
                  repos = MultiRepo::RepoSet[repo_set]&.deep_dup
          Severity: Minor
          Found in lib/multi_repo/cli.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 destroy_tag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def destroy_tag(tag, output: false)
                client = output ? self.client : self.client.capturing
          
                if dry_run
                  puts "** dry-run: git tag --delete #{tag}".light_black
          Severity: Minor
          Found in lib/multi_repo/service/git.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 run_script has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def run_script
                repo.chdir do
                  Bundler.with_unbundled_env do
                    parts = []
                    parts << "GITHUB_REPO=#{repo.name}"
          Severity: Minor
          Found in lib/multi_repo/helpers/pull_request_blaster_outer.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 with_repo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def with_repo(repo, options)
                repo_name = downstream_repo_name(repo, options)
                puts "\n==== Mirroring #{repo_name} ====".bold.cyan
          
                working_dir = settings.git_mirror.working_directory
          Severity: Minor
          Found in lib/multi_repo/helpers/git_mirror.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 system has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def system(*args)
                puts "+ #{"dry_run: " if dry_run?}#{args.join(" ")}"
                return true if dry_run?
          
                args << {} unless args.last.is_a?(Hash)
          Severity: Minor
          Found in lib/multi_repo/helpers/git_mirror.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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def list(folder, cache: @cache, **kwargs)
                folder = folder.to_s
                cache_file = "/tmp/artifactory-#{folder.tr("/", "_")}-#{Date.today}.txt"
                if cache && File.exist?(cache_file)
                  File.readlines(cache_file, :chomp => true)
          Severity: Minor
          Found in lib/multi_repo/service/artifactory.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 remote_refs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def remote_refs(repo, remote)
                return unless remote_exists?(remote)
          
                `git ls-remote #{remote} | grep "heads"`.split("\n").collect do |line|
                  branch = line.split("/").last
          Severity: Minor
          Found in lib/multi_repo/helpers/git_mirror.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 common_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.common_options(optimist, only: %i[repo repo_set dry_run], except: nil, repo_set_default: "master")
                optimist.banner("")
                optimist.banner("Common Options:")
          
                subset = Array(only).map(&:to_sym) - Array(except).map(&:to_sym)
          Severity: Minor
          Found in lib/multi_repo/cli.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 raw_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def raw_list(folder, cache: @cache, **kwargs)
                folder = folder.to_s
                cache_file = "/tmp/artifactory-#{folder.tr("/", "_")}-raw-#{Date.today}.json"
                if cache && File.exist?(cache_file)
                  JSON.parse(File.read(cache_file))
          Severity: Minor
          Found in lib/multi_repo/service/artifactory.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