Method post_processing
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
def post_processing
@opts.each do |opt|
raise NoRequiredOption, "The option #{opt.to_long} is required" if opt.required? && !@results.key?(opt.to_sym)
next if opt.required_unless.empty? || @results.key?(opt.to_sym)
Method load_config_files
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
def load_config_files
files_data = config_files.parse
@opts.each do |opt|
next unless files_data.key?(opt.to_sym)
Method register_callback
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
def register_callback(opt)
on(*opt.option) do |arg|
if opt.alias?
parse!(opt.alias_for.split)
else
Method verify_compatibility
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
def verify_compatibility(values)
incompatible.each do |a|
last_match = ''
a.each do |key|
Method validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def validate(value)
results = {}
super.each do |item|
opt = choices[item.to_sym]
Method normalize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def normalize(value)
Array(attrs[:normalize]).each do |method|
next unless method.is_a?(Symbol)
value = value.send(method) if value.respond_to?(method)