fortinmike/git-multirepo

View on GitHub

Showing 18 of 18 total issues

Method merge_core has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def merge_core(main_repo, initial_revision, mode)
      config_file = ConfigFile.new(".")
      
      # Ensure the main repo is clean
      fail MultiRepoException, "Main repo is not clean; merge aborted" unless main_repo.clean?
Severity: Minor
Found in lib/multirepo/commands/merge-command.rb - About 3 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 ensure_no_dependency_cycle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def ensure_no_dependency_cycle(node)
      parent = node.parent
      visited = []
      while parent
        visited.push(parent)
Severity: Minor
Found in lib/multirepo/logic/node.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 merge_core has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def merge_core(main_repo, initial_revision, mode)
      config_file = ConfigFile.new(".")
      
      # Ensure the main repo is clean
      fail MultiRepoException, "Main repo is not clean; merge aborted" unless main_repo.clean?
Severity: Minor
Found in lib/multirepo/commands/merge-command.rb - About 1 hr to fix

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

    def create_entries(repos)
      entries = []
      repos.each do |repo|
        origin_url = repo.remote('origin').url
        current_branch_name = repo.current_branch.name
Severity: Minor
Found in lib/multirepo/commands/init-command.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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      Console.log_step("Cloning #{@url} ...")

      fail MultiRepoException, "A directory named #{@name} already exists" if Dir.exist?(@name)

Severity: Minor
Found in lib/multirepo/commands/clone-command.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 determine_merge_state has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def determine_merge_state(repo, their_ref)
      return TheirState::NON_EXISTENT unless their_ref.exists?
      
      remote_branch = repo.remote_branches.find { |b| b.name == their_ref.name }
      local_branch = repo.local_branches.find { |b| b.name == their_ref.name }
Severity: Minor
Found in lib/multirepo/logic/merge-descriptor.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 perform_main_repo_checkout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.perform_main_repo_checkout(main_repo, ref_name, force = false, message = nil)
      # Make sure the main repo is clean before attempting a checkout
      unless force || main_repo.clean?
        fail MultiRepoException, "Can't checkout #{ref_name} because the main repo contains uncommitted changes"
      end
Severity: Minor
Found in lib/multirepo/logic/performer.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 dependencies_clean? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.dependencies_clean?(config_entries)
      clean = true
      missing = false
      config_entries.each do |e|
        # Ensure the dependency exists
Severity: Minor
Found in lib/multirepo/utility/utils.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 perform_merges has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def perform_merges(descriptors)
      success = true
      descriptors.each do |descriptor|
        Console.log_substep("#{descriptor.name} : Merging #{descriptor.their_revision} into #{descriptor.our_revision}...")
        GitRunner.run_as_system(descriptor.repo.path, "merge #{descriptor.their_revision}#{@edit ? '' : ' --no-edit'}#{@fast_forward ? '' : ' --no-ff'}")
Severity: Minor
Found in lib/multirepo/commands/merge-command.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      ensure_in_work_tree
      ensure_multirepo_enabled
      
      Console.log_step("Branching...")
Severity: Minor
Found in lib/multirepo/commands/branch-command.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 perform_branch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def perform_branch(repo)
      Console.log_substep("Branching '#{repo.path}' ...")
      Console.log_info("Creating and checking out branch #{@branch_name} ...")
      
      branch = repo.branch(@branch_name)
Severity: Minor
Found in lib/multirepo/commands/branch-command.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 clone has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def clone(url, options = nil)
      options = {} unless options
      
      branch = options[:branch]

Severity: Minor
Found in lib/multirepo/git/repo.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

Avoid too many return statements within this method.
Open

      return determine_local_upstream_merge_state(repo, their_ref)
Severity: Major
Found in lib/multirepo/logic/merge-descriptor.rb - About 30 mins to fix

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

    def run
      ensure_in_work_tree unless @ci
      ensure_multirepo_tracked
      
      if @hooks
Severity: Minor
Found in lib/multirepo/commands/install-command.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 ensure_repo_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def ensure_repo_valid
      fail MultiRepoException, "The provided path is not a direct sibling of the main repository" unless validate_is_sibling_repo(@path)
      fail MultiRepoException, "There is no folder at path '#{@path}'" unless Dir.exist?(@path)
      fail MultiRepoException, "'#{@path}' is not a repository" unless Repo.new(@path).exists?
    end
Severity: Minor
Found in lib/multirepo/commands/add-command.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.run(cmd, verbosity)
      Console.log_info("Command: #{cmd}") if Config.instance.verbose
      
      lines = []
      last_command_succeeded = false
Severity: Minor
Found in lib/multirepo/utility/popen-runner.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 clone_or_fetch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def clone_or_fetch(dependency)
      if dependency.config_entry.repo.exists?
        check_repo_validity(dependency)
        
        Console.log_substep("Working copy '#{dependency.config_entry.repo.path}' already exists, fetching...") 
Severity: Minor
Found in lib/multirepo/commands/install-command.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 full_initialize_step has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def full_initialize_step
      if ConfigFile.new(".").exists?
        reinitialize = Console.ask(".multirepo file already exists. Reinitialize?")
        fail MultiRepoException, "Initialization aborted" unless reinitialize
      end
Severity: Minor
Found in lib/multirepo/commands/init-command.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