Showing 39 of 48 total issues
Method replace_markers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def replace_markers(message, plain = false)
stack = []
message.ensure_string.gsub(/((\{mark=([a-z\-_\s,]+)\})|(\{\/mark\}))/mi) do
if $LAST_MATCH_INFO[1] == "{/mark}" # If it is a tag, pop from the latest opened.
- 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 copy_or_move
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def copy_or_move(src, dst, operation, run = true, show_errors = true, fatal = true)
Method validate_input_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_input_value(reply, validator)
# Match against the validator
if validator.present?
if validator.is_a?(Array)
reply = validate_array(reply, validator)
- 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 progress
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def progress(current, total, type: :list, precision: 0)
if type == :list
compute_list_progress(current, total)
else
precision = [0, precision].max
- 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 create_directory
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_directory(directory, mode, fatal, directories, show_errors)
Method try_create_directory
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def try_create_directory(directory, mode, fatal, directories, show_errors)
Method check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check(path, *tests)
path = path.ensure_string
tests.ensure_array(no_duplicates: true, compact: true, flatten: true).all? do |test|
# Adjust test name
- 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 indent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def indent(message, width = true, newline_separator = "\n")
if width.to_integer != 0
width = (width.is_a?(TrueClass) ? 0 : width.to_integer)
width = width < 0 ? -width : @indentation + width
- 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_help
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def show_help
console = application? ? self.console : application.console
application? ? show_help_application_summary(console) : show_help_command_summary(console)
show_help_banner(console) if banner?
show_help_options(console) if options?
- 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 check_sources
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_sources(src, operation, fatal)
# Check that every file is existing
src.ensure_array.each do |s|
unless check(s, :exists)
@console.send(fatal ? :fatal : :error, i18n.copy_move_src_not_found(operation, s))
- 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_input_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_input_value(prompt, echo, default_value = nil)
if prompt
Kernel.print(format(prompt, suffix: false, indented: false))
$stdout.flush
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 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"