Showing 5 of 5 total issues
Method list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list
files = Dir.glob("#{@@home}/*").select {|f| File.directory? f}
if files.size > 0
puts "There #{files.size == 1 ? 'is' : 'are'} #{files.size} #{files.size == 1 ? 'template' : 'templates'}:"
last = Pathname.new(files.last).basename
- 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 parse_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_options
OptionParser.new do |opts|
opts.banner = "Usage: laadur [options]"
opts.on("-v", "--version", "print gem version") do puts Laadur::VERSION end
opts.on("-h", "--help", "help window") do puts opts end
- 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 parse_multiple_args
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_multiple_args
ARGV.each do |template|
if template.match /^--|-/
if self.template? template
puts "There is option with name #{b template} and a path #{@@home}/#{b template}."
- 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 remove_template
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remove_template template
if self.template? template
print "You asked to remove template #{b template} (#{@@home}/#{template}). Are you sure? [y/n] "
begin
FileUtils.rm_rf "#{@@home}/#{template}" rescue puts "Something went wrong."
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize
@@home = "#{Dir.home}/.laadur"
Dir.mkdir(File.join(Dir.home, ".laadur"), 0700) if not File.directory? @@home
@@workpath = Dir.pwd
- 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"