Showing 88 of 88 total issues
File repository.rb
has 589 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'grit/git-ruby/internal/raw_object'
require 'grit/git-ruby/internal/pack'
require 'grit/git-ruby/internal/loose'
require 'grit/git-ruby/git_object'
Class Repo
has 66 methods (exceeds 20 allowed). Consider refactoring. Open
class Repo
include POSIX::Spawn
DAEMON_EXPORT_FILE = 'git-daemon-export-ok'
BATCH_PARSERS = {
Method diff
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def diff(commit1, commit2, options = {})
patch = ''
commit_obj1 = get_object_by_sha1(commit1)
tree1 = commit_obj1.tree
- Read upRead up
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
File repo.rb
has 453 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Grit
class Repo
include POSIX::Spawn
DAEMON_EXPORT_FILE = 'git-daemon-export-ok'
Method walk_log
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def walk_log(sha, opts, total_size = 0)
return [] if @already_searched[sha] # to prevent rechecking branches
@already_searched[sha] = true
array = []
- Read upRead up
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 ls_tree_path
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def ls_tree_path(sha, path, append = nil)
tree = get_raw_tree(sha)
if path =~ /\//
paths = path.split('/')
last = path[path.size - 1, 1]
- Read upRead up
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
Class Repository
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class Repository
class NoSuchShaFound < StandardError
end
Method quick_diff
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def quick_diff(tree1, tree2, path = '.', recurse = true)
# handle empty trees
return changed if tree1 == tree2
t1 = list_tree(tree1) if tree1
- Read upRead up
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 native
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def native(cmd, options = {}, *args, &block)
args = args.first if args.size == 1 && args[0].is_a?(Array)
args.map! { |a| a.to_s }
args.reject! { |a| a.empty? }
- Read upRead up
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 tags
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def tags(options, prefix)
refs = []
already = {}
orig_prefix = prefix
- Read upRead up
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
Class Git
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Git
include POSIX::Spawn
class GitTimeout < RuntimeError
attr_accessor :command
Method advanced_grep
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def advanced_grep(searchtext, contextlines = 3, branch = 'master')
# If there's not an even number of quote marks, get rid of them all
searchtext = searchtext.gsub('"', '') if searchtext.count('"') % 2 == 1
- Read upRead up
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
File git_object.rb
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'stringio'
module Grit
module GitRuby
Method rev_parse
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def rev_parse(options, string)
raise RuntimeError, "invalid string: #{string.inspect}" unless string.is_a?(String)
# Split ranges, but don't split when specifying a ref:path.
# Don't split HEAD:some/path/in/repo..txt
- Read upRead up
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
File git.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'tempfile'
require 'posix-spawn'
module Grit
class Git
Class Commit
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Commit
extend Lazy
attr_reader :id
attr_reader :repo
Method refs
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def refs(options, prefix)
refs = []
already = {}
orig_prefix = prefix
prefix = File.join @git_dir, prefix
- Read upRead up
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 list_from_string
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.list_from_string(repo, text)
text_gpgless = text.gsub(/gpgsig -----BEGIN PGP SIGNATURE-----[\n\r](.*[\n\r])*? -----END PGP SIGNATURE-----[\n\r]/, "")
lines = text_gpgless.split("\n")
commits = []
- Read upRead up
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 diff
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def diff(commit1, commit2, options = {})
patch = ''
commit_obj1 = get_object_by_sha1(commit1)
tree1 = commit_obj1.tree
Method advanced_grep
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def advanced_grep(searchtext, contextlines = 3, branch = 'master')
# If there's not an even number of quote marks, get rid of them all
searchtext = searchtext.gsub('"', '') if searchtext.count('"') % 2 == 1