Showing 10 of 10 total issues
Method parse
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse args=ARGV
OptionParser.new do |opts|
# Setup
version_path = File.expand_path('../../VERSION', File.dirname(__FILE__))
opts.version = File.exist?(version_path) ? File.read(version_path) : ''
Method split_task
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def split_task task
# If the task fits
if task.length <= TrackingConfig[:task_width]
return [task]
- 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 display_task
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def display_task(task)
split_task(task.name).each_with_index do |name_line, line_index|
col_1 = pad((task.start_time if line_index==0), 5)
col_2 = pad(name_line, @name_width)
col_3 = pad((task.elapsed_time if line_index==0), @elapsed_time_width)
- 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 get
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get options={}
if File.exist? @data_file
# Read all lines from the data file
lines = CSV.read(@data_file, @csv_options)
# Shorten lines to meet TrackingConfig[:lines], if needed
- 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 split_task
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def split_task task
# If the task fits
if task.length <= TrackingConfig[:task_width]
return [task]
Method elapsed_time
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def elapsed_time format=TrackingConfig[:elapsed_format], show_seconds=TrackingConfig[:show_elapsed_seconds]
# Calculate the elapsed time and break it down into different units
seconds = ((self.current? ? Time.now : @end_time) - @start_time).floor
minutes = hours = days = 0
if seconds >= 60
- 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 too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return ' '*(difference/2).floor + string + ' '*(difference/2).ceil
Avoid too many return
statements within this method. Open
return