Showing 6 of 6 total issues
Class Application
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Application
TIME_FORMAT = /^(\d+(\.\d+)?:?\+?)|(\d+:\d+\+?)|\+$/
FLIRTS = [
'I like your hairstyle.', 'What a nice console you have.', 'My favorite color is red on black, monospaced.',
"What a lovely operation system this #{`uname`} is.", 'What about dinner tonight?', 'Your keystrokes are tingling.'
Method colorize
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def colorize(options={})
return '' if self == ''
options = {:color => options} if options.is_a?(Symbol)
options[:color] = :default unless options[:color]
if options[:color] != :default && options[:color].to_s =~ /^(light|bright)/
- 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 inspect
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def inspect
output = []
output << formatted_time.colorize(tracking? ? :lightyellow : :lightred)
output << formatted_revenue.colorize(:lightgreen) if revenue
output << "\tdoing #{service.name}" if service
- 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 try_to_setup_bash_completion
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def try_to_setup_bash_completion
bash_code = "\n\n#{MiteCmd::BASH_COMPLETION}"
['~/.bash_completion', '~/.bash_profile', '~/.bash_login', '~/.bashrc'].each do |file|
bash_config_file = File.expand_path file
- 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 create_time_entry
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_time_entry(arguments)
attributes = {}
if time_string = arguments.select { |a| a =~ TIME_FORMAT }.first
attributes[:minutes] = parse_minutes(time_string)
start_tracker = (time_string =~ /\+$/)
- 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 formatted_time
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def formatted_time
minutes = tracking? ? tracker.minutes : self.minutes
if minutes > 59
h = minutes/60
m = minutes-h*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"