Showing 27 of 32 total issues
Method initialize
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def initialize(package_manager: nil, **kwargs)
super(**kwargs)
@package_manager = package_manager || begin
if macos?
- 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 run
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
header = ['A', 'B', 'C']
table = [
['AAAA', 'BBBB', 'CCCC'],
['AAAA', 'BBBB', 'CCCC'],
Method run
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def run(name=nil)
if name
unless ITEMS.include?(name)
print_error "unknown item: #{name}"
exit(1)
- 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
File colors.rb
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'stdio'
require_relative 'env'
module CommandKit
#
Method ask_multiline
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def ask_multiline(prompt, help: nil,
default: nil,
required: false,
terminator: :ctrl_d)
case terminator
- 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 underscore
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.underscore(name)
scanner = StringScanner.new(name.to_s)
new_string = String.new
until scanner.eos?
- 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 install_packages
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install_packages(*packages, yes: false,
apt: nil,
brew: nil,
dnf: nil,
pacman: nil,
Method ask
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def ask(prompt, default: nil, required: false)
prompt = prompt.chomp
prompt << " [#{default}]" if default
prompt << ": "
- 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
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def format(&block)
yield format_top_border if @style.border
separator_row = if @table.header? || @style.separate_rows?
format_separator_row
- 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_arguments
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def help_arguments
unless (arguments = self.class.arguments).empty?
puts
puts 'Arguments:'
- 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 command
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def command(name)
unless (command_class = self.class.get_command(name))
return
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 install_packages
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def install_packages(*packages, yes: false,
apt: nil,
brew: nil,
dnf: nil,
pacman: 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 ask_multiline
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ask_multiline(prompt, help: nil,
default: nil,
required: false,
terminator: :ctrl_d)
case terminator
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(**kwargs)
super(**kwargs)
@open_command = if macos?
'open'
- 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_completion_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def normalize_completion_file(path, type: :bash)
ext = File.extname(path)
file = File.basename(path,ext)
case [shell_type, type]
- 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
Avoid deeply nested control flow statements. Open
:apt if command_installed?('apt')
Avoid deeply nested control flow statements. Open
:pkg_add if command_installed?('pkg_add')
Method help
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def help
if stdout.tty?
if self.class.man_dir
status = help_man
- 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 run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run(command=nil)
case command
when nil
parent_command.help
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
Avoid deeply nested control flow statements. Open
elsif suse_linux?
:zypper if command_installed?('zypper')
elsif arch_linux?
:pacman if command_installed?('pacman')