gitlabhq/grit

View on GitHub
lib/grit/git-ruby/git_object.rb

Summary

Maintainability
B
6 hrs
Test Coverage

File git_object.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'stringio'

module Grit
  module GitRuby

Severity: Minor
Found in lib/grit/git-ruby/git_object.rb - About 2 hrs to fix

    Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(tree, parent, author, committer, message, headers, repository=nil)
    Severity: Major
    Found in lib/grit/git-ruby/git_object.rb - About 50 mins to fix

      Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(object, type, tag, tagger, message, repository=nil)
      Severity: Minor
      Found in lib/grit/git-ruby/git_object.rb - About 45 mins to fix

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

          def self.read_bytes_until(io, char)
            string = ''
            if RUBY_VERSION > '1.9'
              while ((next_char = io.getc) != char) && !io.eof
                string += next_char
        Severity: Minor
        Found in lib/grit/git-ruby/git_object.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(str)
              @email = ''
              @date = Time.now
              @offset = 0
        
        
        Severity: Minor
        Found in lib/grit/git-ruby/git_object.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 from_raw has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.from_raw(rawobject, repository=nil)
        
              headers, message = rawobject.content.split(/\n\n/, 2)
              headers = headers.split(/\n/).map { |header| header.split(' ', 2) }
        
        
        Severity: Minor
        Found in lib/grit/git-ruby/git_object.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

        There are no issues that match your filters.

        Category
        Status