rosette-proj/rosette-core

View on GitHub
lib/rosette/core/git/repo.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class Repo has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Repo
      attr_reader :jgit_repo

      # Creates a repo instance from the given path.
      #
Severity: Minor
Found in lib/rosette/core/git/repo.rb - About 3 hrs to fix

    Method get_rev_commit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def get_rev_commit(ref_or_commit_id, walker = rev_walker)
            walker.parseCommit(
              ObjectId.fromString(ref_or_commit_id)
            )
          rescue Java::OrgEclipseJgitErrors::MissingObjectException, Java::JavaLang::IllegalArgumentException => e
    Severity: Minor
    Found in lib/rosette/core/git/repo.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 each_commit_in_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def each_commit_in_range(start_ref, end_ref)
            if block_given?
              commit_walker = RevWalk.new(jgit_repo).tap do |walker|
                walker.markStart(get_rev_commit(start_ref, walker))
              end
    Severity: Minor
    Found in lib/rosette/core/git/repo.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 find_first_non_merge_parent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def find_first_non_merge_parent(ref)
            each_commit_starting_at(ref).with_index do |prev_rev, idx|
              next if idx == 0
              break prev_rev if prev_rev.getParentCount <= 1
            end
    Severity: Minor
    Found in lib/rosette/core/git/repo.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