lib/grit/index.rb
Method write_tree
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
def write_tree(tree = nil, now_tree = nil)
tree = self.tree if !tree
tree_contents = {}
# fill in original 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
Method commit
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def commit(message, parents = nil, actor = nil, last_tree = nil, head = 'master')
commit_tree_sha = nil
if parents.is_a?(Hash)
commit_tree_sha = parents[:commit_tree_sha]
actor = parents[:actor]
Method write_tree
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def write_tree(tree = nil, now_tree = nil)
tree = self.tree if !tree
tree_contents = {}
# fill in original tree
Method commit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def commit(message, parents = nil, actor = nil, last_tree = nil, head = 'master')
commit_tree_sha = nil
if parents.is_a?(Hash)
commit_tree_sha = parents[:commit_tree_sha]
actor = parents[:actor]
- 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 commit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def commit(message, parents = nil, actor = nil, last_tree = nil, head = 'master')