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 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 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 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 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_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"
Further reading
Method val_to_str
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def val_to_str(val)
if val.nil?
'nil'
elsif val.is_a?(TrueClass)
'true'
- 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_with_param
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_option_with_param(options, opts, names, opt_name, settings = {})
opts.on(*names, settings[:type] || String) { |param|
if settings[:append]
options[opt_name] << param
else
- 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 param_option_name_mod
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def param_option_name_mod(names, settings)
names[0] << ' PARAM' unless names.any? { |v| v.include?(' ') }
names = settings.has_key?(:desc) ? (names + [settings[:desc]]) : names
settings.has_key?(:type) ? (names + [settings[:type]]) : names
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 param_option_value_determine
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def param_option_value_determine(current_value, new_value, settings)
settings[:append] ? (current_value + new_value) : ((new_value.nil? || new_value == '') ? current_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"