ontohub/ontohub

View on GitHub
lib/git_repository/history.rb

Summary

Maintainability
C
1 day
Test Coverage

Method commits_path has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def commits_path(walker, limit, offset, path, &block)
    commits = []

    object = nil
    commit = nil
Severity: Minor
Found in lib/git_repository/history.rb - About 5 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 commits_all has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def commits_all(walker, limit, offset, &block)
    commits = []
    original_offset = offset

    walker.each_with_index do |c,i|
Severity: Minor
Found in lib/git_repository/history.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 commits_path has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def commits_path(walker, limit, offset, path, &block)
    commits = []

    object = nil
    commit = nil
Severity: Minor
Found in lib/git_repository/history.rb - About 1 hr to fix

    Method commits has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def commits(start_oid: nil, stop_oid: nil, path: nil, limit: nil, offset: 0, walk_order: nil, &block)
        return [] if @repo.empty?
        start_oid ||= head_oid
        offset = 0 if offset < 0
        stop_oid = nil if stop_oid =~ /\A0+\z/
    Severity: Minor
    Found in lib/git_repository/history.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 commits_path has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def commits_path(walker, limit, offset, path, &block)
    Severity: Minor
    Found in lib/git_repository/history.rb - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status