acant/git_simple

View on GitHub
lib/git_simple.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

class GitSimple
  class Error < StandardError; end
  class MergeConflict < Error; end
  class NoCommonCommit < Error; end
  class PushError < Error; end
Severity: Minor
Found in lib/git_simple.rb - About 2 hrs to fix

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

      def merge(merge_branch, options = {})
        merge_analysis = rugged.merge_analysis(merge_branch.name)
        if merge_analysis.include?(:fastforward)
          rugged.references.update(helper.head_ref, merge_branch.target_id)
          rugged.checkout_head(strategy: :force)
    Severity: Minor
    Found in lib/git_simple.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 merge has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def merge(merge_branch, options = {})
        merge_analysis = rugged.merge_analysis(merge_branch.name)
        if merge_analysis.include?(:fastforward)
          rugged.references.update(helper.head_ref, merge_branch.target_id)
          rugged.checkout_head(strategy: :force)
    Severity: Minor
    Found in lib/git_simple.rb - About 1 hr to fix

      Method inspect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def inspect # rubocop:disable Metrics/AbcSize
          result = "Working directory: #{helper.working_directory}\n"
          result << "  HEAD: #{helper.head_ref}\n"
      
          result << 'Remotes:'
      Severity: Minor
      Found in lib/git_simple.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 pull has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def pull(options = {}, &block)
          return self unless helper.head_remote
          helper.head_remote.fetch(
            Utils.build_remote_options(helper.head_remote, options)
          )
      Severity: Minor
      Found in lib/git_simple.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 push has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def push(options = {})
          return self if rugged.empty?
          return self unless helper.head_remote
      
          helper.head_remote.push(
      Severity: Minor
      Found in lib/git_simple.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

      There are no issues that match your filters.

      Category
      Status