Showing 12 of 12 total issues
Method calculate_subcells
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def calculate_subcells
case @wrap_preserve
when :rune
line_index = 0
formatted_content.split(Util::NEWLINE, -1).flat_map do |substr|
- 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 table.rb
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "tty-screen"
require "unicode/display_width"
module Tabulo
Class Table
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Table
include Enumerable
# @!visibility public
DEFAULT_BORDER = :ascii
Method calculate_subcells
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calculate_subcells
case @wrap_preserve
when :rune
line_index = 0
formatted_content.split(Util::NEWLINE, -1).flat_map do |substr|
Method formatted_title
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def formatted_title
columns = get_columns
extra_for_internal_dividers = (@border == :blank ? 0 : 1)
Method pack
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def pack(max_table_width: :auto, except: nil)
autosize_columns(except: except)
max_width = nil
if max_table_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 add_column
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_column(label, align_body: nil, align_header: nil, before: nil, formatter: nil,
header: nil, header_styler: nil, padding: nil, styler: nil, width: nil, wrap_preserve: nil, &extractor)
column_label = normalize_column_label(label)
Method initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(sources, *columns, align_body: :auto, align_header: :center, align_title: :center,
border: nil, border_styler: nil, column_padding: nil, column_width: nil, formatter: :to_s.to_proc,
header_frequency: :start, header_styler: nil, row_divider_frequency: nil, styler: nil,
title: nil, title_styler: nil, truncation_indicator: nil, wrap_preserve: :rune, wrap_body_cells_to: nil,
wrap_header_cells_to: nil)
Method add_column
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_column(label, align_body: nil, align_header: nil, before: nil, formatter: nil,
header: nil, header_styler: nil, padding: nil, styler: nil, width: nil, wrap_preserve: nil, &extractor)
column_label = normalize_column_label(label)
- 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_title
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def formatted_title
columns = get_columns
extra_for_internal_dividers = (@border == :blank ? 0 : 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 shrink_to
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def shrink_to(max_table_width, except: nil)
min_content_width_per_column = 1
min_total_column_content_width = num_columns * min_content_width_per_column
min_table_width = total_padding_width + total_borders_width + min_total_column_content_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 formatted_body_row
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def formatted_body_row(source, header:, divider:, index:)
cells = get_columns.map.with_index { |c, i| c.body_cell(source, row_index: index, column_index: i) }
inner = format_row(cells, @wrap_body_cells_to)
if @title && header == :top
- 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"