Showing 14 of 14 total issues
Method update_card_array_attribute
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def update_card_array_attribute(current_board, card, opt)
values = opt.eql?(:+) ? options.add : options.remove
key = values.shift
if key.eql? 'participants'
- 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
Class Board
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Board
include Toy::Store
# Associations
list :lists, List
Method operate_on_card
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def operate_on_card(current_board, card_id_or_title, card_id = card_id_or_title)
card = Kood::Card.find_by_partial_id_or_title!(card_id_or_title)
copy_card(card) if options.copy.present?
delete_card(card_id) if options.key? 'delete'
- 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 print_board
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def print_board(board)
opts = options.color? ? { color: [:black, :bold] } : {}
num_lists = board.list_ids.size
header = Kood::Table.new(num_lists)
body = Kood::Table.new(num_lists)
- 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 list_existing_boards
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def list_existing_boards
return error "No boards were found." if Kood.config.boards.empty?
max_board_id = Kood.config.boards.max_by { |b| b.id.size }.id.size
Kood.config.boards.each do |b|
- 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 card
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def card(card_id_or_title = nil)
Kood::Board.current!.with_context do |current_board|
card_title = card_id = card_id_or_title
# If no arguments and options are specified, display all existing cards
- 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 print_board
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print_board(board)
opts = options.color? ? { color: [:black, :bold] } : {}
num_lists = board.list_ids.size
header = Kood::Table.new(num_lists)
body = Kood::Table.new(num_lists)
Method load_plugins
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.load_plugins
program = File.basename $PROGRAM_NAME
command = ARGV.first
command = ARGV[1] if command.eql? 'help' and ARGV.length > 1 # Help command
- 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 terminal_size
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def terminal_size
if (ENV['COLUMNS'] =~ /^\d+$/) && (ENV['LINES'] =~ /^\d+$/)
[ENV['COLUMNS'].to_i, ENV['LINES'].to_i]
elsif (RUBY_PLATFORM =~ /java/ || (!STDIN.tty? && ENV['TERM'])) && command_exists?('tput')
[`tput cols`.to_i, `tput lines`.to_i]
- 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 hyphenize_row
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def hyphenize_row(i, slice, row)
if slice[-1] != ' ' and row[i] and row[i] != ' '
last_word = slice.split.last
len_diff = slice.length - last_word.length
if not last_word.blank? and last_word.length <= (@width * 0.25).floor
- 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 edit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def edit(card_id_or_title = nil)
Kood::Board.current!.with_context do |current_board|
card = Kood::Card.find_by_partial_id_or_title!(card_id_or_title)
success, command = 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 find_by_partial_attribute!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find_by_partial_attribute!(attrs, search_param, options = {})
must_unique = options[:unique] == true
# Find partial (and exact) matches
matches = find_all_by_partial_attribute(attrs, search_param, options)
- 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 slice_row
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def slice_row(row, options = {})
sliced_rows = []
i = 0
while slice = row[i, @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 print_card
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def print_card(board, card)
# The board's table may not use all terminal's horizontal space. In order to keep
# things visually similar / aligned, the card table should have the same width.
width = Kood::Table.new(board.list_ids.size).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"