Showing 24 of 24 total issues
File option.rb
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'safe/maputil'
require 'optparse'
require 'yaml'
module EverydayCliUtils
Method register
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def register(order, opts, options, opt_name, names, exit_on_action, print_on_exit_str, settings, default_settings, action_block, pre_parse_block = nil)
Method run_nmeans
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.run_nmeans(avg, cnt, collection, ft, ft1, ft2, ks, ks1, max_k, threshold)
Method register
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def register(opts, options, type, opt_name, names, settings = {}, default_settings = {}, &block)
Method register_special
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def register_special(order, opt_name, names, exit_on_action, print_on_exit_str, settings, action_block, pre_parse_block = nil)
Method run_nmean
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.run_nmean(collection, avg, cnt, ft, ft2, k, ks)
Method defaults_options_helper
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def defaults_options_helper(file_path, names, settings, order, opt_name, print_on_exit_string, composite_name)
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(order, exit_on_action, names, print_on_exit_str, settings, action_block, pre_parse_block = nil)
Method method_missing
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method, *args)
name = method.to_s
colors = 'black|red|green|yellow|blue|purple|cyan|white|none'
if (name =~ /format(_bold)?(_underline)?(?:_fg_(#{colors}))?(?:_bg_(#{colors}))?/).nil?
old_method_missing(method, *args)
- 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 show_info_helper
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def show_info_helper(names, settings, order, opt_name, exit_on_sym, &block)
Method format_all
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self::format_all(text)
colors = 'bk|rd|gr|yw|bl|pu|cy|wh|no'
color_map = { 'bk' => :black, 'rd' => :red, 'gr' => :green, 'yw' => :yellow, 'bl' => :blue, 'pu' => :purple, 'cy' => :cyan, 'wh' => :white, 'no' => :none }
regex = /\{(.+?)\}\((bd)?(ul)?(?:f(#{colors}))?(?:b(#{colors}))?\)/
regex2 = /\{(.+?)\}\(:(.+?)\)/
- 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_averages
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.add_averages(height, ks, lines, mi, step, width)
Method param_option_value_transform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def param_option_value_transform(new_value, settings)
new_value.is_a?(Array) ? (settings[:append] ? new_value : new_value[0]) : (settings[:append] ? [new_value] : new_value)
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 add_option
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_option(options, opts, names, opt_name, settings = {})
Method add_graph
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.add_graph(counts, height, lines, max_y, width)
Method call_override_at_index
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def call_override_at_index(overrides, ind, ovin, args, &block)
Method add_option_with_param
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_option_with_param(options, opts, names, opt_name, settings = {})
Method def_type
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def def_type(type, default_value_block, value_determine_block, name_mod_block = nil, value_transform_block = nil)
Method register
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def register(type, opt_name, names, settings = {}, &block)
Method run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run(options_list)
if @state
@action_block.call(self, options_list)
if @exit_on_action
puts @print_on_exit_str unless @print_on_exit_str.nil?
- 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"