Showing 36 of 50 total issues
Method process_double_option
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def process_double_option(long, sep, rest)
opt, value = nil, nil
if (opt = @longs[long])
if opt.argument_required?
- 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 process_single_option
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def process_single_option(short, other_singles)
opt, value = nil, nil
if (opt = @shorts[short])
if opt.argument_required?
- 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 Formatter
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Formatter
include UsageWrapper
BOOLEANS = [true, false].freeze
DEFAULT_WIDTH = 80
Class Parameter
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Parameter
include Comparable
include DSL::Arity
include DSL::Conversion
File formatter.rb
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "sections"
require_relative "usage_wrapper"
module TTY
module Option
Method process_double_option
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_double_option(long, sep, rest)
opt, value = nil, nil
if (opt = @longs[long])
if opt.argument_required?
Method next_envvar
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def next_envvar
env_var, value = nil, nil
while !@argv.empty? && !env_var?(@argv.first)
@remaining << @argv.shift
- 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 next_keyword
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def next_keyword
kwarg, value = nil, nil
while !@argv.empty? && !keyword?(@argv.first)
@remaining << @argv.shift
- 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 process_single_option
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_single_option(short, other_singles)
opt, value = nil, nil
if (opt = @shorts[short])
if opt.argument_required?
Method process_infinite_arity
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process_infinite_arity(arg)
values = []
arity = arg.arity.abs - 1
arity.times do
- 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 assign_keyword
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def assign_keyword(kwarg, val)
value = @pipeline.(kwarg, val)
if kwarg.multiple?
allowed = kwarg.arity < 0 || @arities[kwarg.key] <= kwarg.arity
- 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 assign_envvar
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def assign_envvar(env_arg, val)
value = @pipeline.(env_arg, val)
if env_arg.multiple?
allowed = env_arg.arity < 0 || @arities[env_arg.key] <= env_arg.arity
- 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 assign_option
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def assign_option(opt, val)
value = @pipeline.(opt, val)
if opt.multiple?
allowed = opt.arity < 0 || @arities[opt.key] <= opt.arity
- 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 help
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def help
sections = Sections.new
sections.add(:header, help_header) if @usage.header?
sections.add(:banner, help_banner)
- 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 initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(parameters, remaining: [], errors: [])
@parameters = parameters
@parameters.default_proc = ->(hash, key) do
return hash[key] if hash.key?(key)
- 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 setup_opts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def setup_opts
@options.each do |opt|
@shorts[opt.short_name] = opt
@longs[opt.long_name] = opt
@arity_check << opt if opt.multiple?
- 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 parse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse(argv, env)
@argv = argv.dup
@env = env
loop do
- 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 parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse(argv)
@argv = argv.dup
loop do
opt, value = next_option
- 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 format_parameter_description
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def format_parameter_description(param)
desc = []
desc << " #{param.desc}" if param.desc?
- 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 process_exact_arity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def process_exact_arity(arg)
values = []
arity = arg.arity
while arity > 0
- 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"