Showing 9 of 9 total issues
Method run
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
def run(data)
blocks = []
total_diffs, total_mins = 0, 0
add_commit = lambda do |commit|
- 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 run
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(data)
blocks = []
total_diffs, total_mins = 0, 0
add_commit = lambda do |commit|
Method align
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def align(strings, cols = COLS, sep = " ")
ret = ""
size = 0
strings.each do |string, method|
ultimate = (string == strings.keys[-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
Method print_chart
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def print_chart(condensed)
cols = condensed ? 30 : COLS
total_sum = 0
current_day = nil
@clockout.blocks.each do |block|
- 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 print_timeline
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def print_timeline(block)
# subtract from the time it took for first commit
time = (block.first.date - block.first.minutes*60).strftime('%l:%M %p')+": "
print time.yellow
- 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
Avoid deeply nested control flow statements. Open
curr_c.clocked_in = true if prev_c && prev_c.class == Clock && prev_c.in
Avoid deeply nested control flow statements. Open
if prev_c.minutes
prev_c.minutes += addition
add_time_to_day.call(addition, prev_c.date)
else
# This means it's an estimation commit (first one)
Avoid deeply nested control flow statements. Open
if add_commit.call(curr_c) || curr_c.clocked_in
curr_c.minutes = (curr_c.date - prev_c.date)/60.0 # clock or commit, doesn't matter
end
Method as_time
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def as_time(type = nil, min_s = " min", hr_s = " hrs")
type = (self < 60) ? :minutes : :hours if !type
if type == :minutes
"#{self.round(0)}#{min_s}"
else
- 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"