File application.rb
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Risu
module CLI
# Application class for Risu
class Application
Method parse_options
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_options
begin
opts = OptionParser.new do |opt|
opt.banner = "#{APP_NAME} v#{VERSION}\nJacob Hammack\nhttp://www.hammackj.com\n\n"
opt.banner << "Usage: #{APP_NAME} [options] [files_to_parse]"
Method run
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
parse_options
if @options[:list_templates]
@template_manager.display_templates
Method parse_options
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def parse_options
begin
opts = OptionParser.new do |opt|
opt.banner = "#{APP_NAME} v#{VERSION}\nJacob Hammack\nhttp://www.hammackj.com\n\n"
opt.banner << "Usage: #{APP_NAME} [options] [files_to_parse]"
- 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 a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def run
parse_options
if @options[:list_templates]
@template_manager.display_templates
- 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 migrate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def migrate direction
begin
if @database["adapter"] == nil
return false, "[!] Invalid database adapter, please check your configuration file"
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 load_config
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def load_config file=CONFIG_FILE, in_memory_config=false
if File.exist?(file) == true or in_memory_config == true
begin
if in_memory_config
yaml = YAML::load(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 db_connect
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def db_connect
begin
if @database["adapter"] == nil
puts "[!] #{@database['adapter']}" if @options[:debug]
- 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 db_connect
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def db_connect
begin
if @database["adapter"] == nil
puts "[!] #{@database['adapter']}" if @options[:debug]
Method migrate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def migrate direction
begin
if @database["adapter"] == nil
return false, "[!] Invalid database adapter, please check your configuration file"
end
Method parse_file
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_file file
begin
puts "[*] Parsing #{file}..."
tstart = Time.new