Showing 48 of 48 total issues
Method set
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set(value, raise_error = true)
vs = get_validator_method(@validator)
rv = vs ? @validator.send(vs, value) : true
if rv
- 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 normalize_patterns
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def normalize_patterns(patterns, by_extension, case_sensitive)
# Adjust patterns
patterns = patterns.ensure_array(no_duplicates: true, compact: true, flatten: true) do |p|
p.is_a?(::Regexp) ? p : Regexp.new(Regexp.quote(p.ensure_string))
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 handle_command_exit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle_command_exit(rv, show_exit, fatal_errors)
@console.status(rv[:status] == 0 ? :ok : :fail) if show_exit
exit(rv[:status]) if fatal_errors && rv[:status] != 0
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 read_configuration_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_configuration_file(file, logger)
# Open the file
path = file =~ /^#{File::SEPARATOR}/ ? file : ::Pathname.new(file).realpath
logger.info(i18n.using(path)) if logger
eval_file(path)
- 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_with
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def setup_with(options = {})
options = {} unless options.is_a?(::Hash)
setup_i18n(options)
options.each_pair do |option, value|
- 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 enter_directory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def enter_directory(directory, show_message, message)
raise ArgumentError unless check(directory, :directory, :executable)
@console.info(message) if show_message
Dir.chdir(directory)
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_style
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_style(styles, plain, stack)
styles = styles.ensure_string
replacement = plain ? "" : Bovem::Console.parse_styles(styles)
unless replacement.empty?
- 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 wrap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def wrap(message, width = nil)
if width.to_integer <= 0
message
else
width = (width == true || width.to_integer < 0 ? line_width : width.to_integer)
- 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"