Showing 18 of 18 total issues
Method to_memory
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def to_memory(permanence = {:new => :new}, exclude_id = true, exclude_timestamps = true)
return nil unless self.grub
buccaneers = []
self.scuttle do |row|
data_hash = self.data_hash_from_row(row, exclude_id, exclude_timestamps)
- 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
File the_capn.rb
has 446 lines of code (exceeds 250 allowed). Consider refactoring. Open
module CsvPirate
class TheCapn
BOOKIE = [:counter, :timestamp, :none]
MOP_HEADS = [:clean, :dirty]
Class TheCapn
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class TheCapn
BOOKIE = [:counter, :timestamp, :none]
MOP_HEADS = [:clean, :dirty]
BRIGANTINE_OPTIONS = [:first, :last]
Method has_csv_pirate_ship
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def has_csv_pirate_ship(options = {})
check_booty = prevent_from_failing_pre_migration
options[:chart] ||= ['log','csv']
options[:aft] ||= '.csv'
- 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 31 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*args)
raise ArgumentError, "must provide required options" if args.nil?
@swag = args.first[:swag]
@grub = args.first[:grub]
- 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 mutiny
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def self.mutiny(capn, first_mate)
carrack = TheCapn.new(capn)
cutthroat = TheCapn.new(first_mate)
cutthroat.figurehead
- 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 to_memory
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_memory(permanence = {:new => :new}, exclude_id = true, exclude_timestamps = true)
return nil unless self.grub
buccaneers = []
self.scuttle do |row|
data_hash = self.data_hash_from_row(row, exclude_id, exclude_timestamps)
Method initialize
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(*args)
raise ArgumentError, "must provide required options" if args.nil?
@swag = args.first[:swag]
@grub = args.first[:grub]
Method mutiny
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.mutiny(capn, first_mate)
carrack = TheCapn.new(capn)
cutthroat = TheCapn.new(first_mate)
cutthroat.figurehead
Method jolly_roger
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def jolly_roger
if self.bury_treasure
if self.buried_treasure.is_a?(Array)
puts "Found #{self.buried_treasure.length} deniers buried here: '#{self.brigantine}'" if TheCapn.parlay && TheCapn.parlance(1)
puts "You must weigh_anchor to review your plunder!" if TheCapn.parlay && TheCapn.parlance(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 has_csv_pirate_ship
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def has_csv_pirate_ship(options = {})
check_booty = prevent_from_failing_pre_migration
options[:chart] ||= ['log','csv']
options[:aft] ||= '.csv'
Method marlinespike
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.marlinespike(spoils, navigation)
navigation.map do |east,west|
# BJM:
if east.is_a?(Array)
spoils = spoils.send(east[0].to_sym, *east[1..-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
Avoid deeply nested control flow statements. Open
obj.save(false) if obj.respond_to?(:save)
Avoid deeply nested control flow statements. Open
if obj.nil?
self.grub.create(data_hash)
end
Method binnacle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def binnacle(join_value, humanize = true)
self.booty.map do |compass|
string = compass.is_a?(Hash) ?
self.run_through(compass, join_value) :
compass.is_a?(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
Avoid deeply nested control flow statements. Open
elsif permanence[:update_or_new]
obj = self.send_aye(data_hash, permanence[:update_or_new])
if obj.nil?
obj = self.grub.new(data_hash)
else
Method get_chronometer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_chronometer(chron)
chron == false ?
false :
(chron || (self.piratey_options[:chronometer] == false ?
false :
- 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 unfurl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unfurl
wibbly = self.waggoner == '' ? '' : Regexp.escape(self.waggoner)
timey = self.sand_glass == '' ? '' : '\.\d+'
wimey = self.gibbet == '' ? '' : Regexp.escape(self.gibbet)
Regexp.new("#{wibbly}#{timey}#{wimey}")
- 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"