Showing 54 of 88 total issues
Class Cli
has 67 methods (exceeds 20 allowed). Consider refactoring. Open
class Cli
attr_accessor :options
# machine host
def host
- Create a ticketCreate a ticket
Method run
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def run
Optimist.educate unless set_host? || key? || database? || db_dump? || db_backup? ||
db_restore? || tmp_disk? || log_disk? ||
uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
set_server_state? || set_replication? || openscap? ||
- Read upRead up
- Create a ticketCreate a ticket
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 cli.rb
has 454 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'optimist'
require 'pathname'
# support for appliance_console methods
unless defined?(say)
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
Optimist.educate unless set_host? || key? || database? || db_dump? || db_backup? ||
db_restore? || tmp_disk? || log_disk? ||
uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
set_server_state? || set_replication? || openscap? ||
saml_config? || saml_unconfig? ||
- Create a ticketCreate a ticket
Class DatabaseConfiguration
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class DatabaseConfiguration
include ManageIQ::ApplianceConsole::ManageiqUserMixin
attr_accessor :adapter, :host, :username, :database, :port, :region, :run_as_evm_server
attr_reader :password
- Create a ticketCreate a ticket
Method disk_usage
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.disk_usage(file = nil)
file_arg = file
file_arg = "-l" if file.nil? || file == ""
unless file_arg == "-l" || File.exist?(file)
- Read upRead up
- Create a ticketCreate a ticket
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_for_database_credentials
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def ask_for_database_credentials(password_twice = true)
self.host = ask_for_ip_or_hostname("database hostname or IP address", host) if host.blank? || !local?
self.port = ask_for_integer("port number", nil, port) unless local?
self.database = just_ask("name of the database on #{host}", database) unless local?
self.username = just_ask("username", username) unless local?
- Read upRead up
- Create a ticketCreate a ticket
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 ExternalHttpdAuthentication
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class ExternalHttpdAuthentication
module ExternalHttpdConfiguration
#
# External Authentication Definitions
#
- Create a ticketCreate a ticket
Method parse
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(args)
args.shift if args.first == "--" # Handle when called through script/runner
self.options = Optimist.options(args) do
banner "Usage: appliance_console_cli [options]"
- Create a ticketCreate a ticket
Class InternalDatabaseConfiguration
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class InternalDatabaseConfiguration < DatabaseConfiguration
attr_accessor :disk
DEDICATED_DB_SHARED_BUFFERS = "'1GB'".freeze
SHARED_DB_SHARED_BUFFERS = "'128MB'".freeze
- Create a ticketCreate a ticket
Class DatabaseAdmin
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class DatabaseAdmin < HighLine
include ManageIQ::ApplianceConsole::Prompts
DB_RESTORE_FILE = "/tmp/evm_db.backup".freeze
DB_DEFAULT_DUMP_FILE = "/tmp/evm_db.dump".freeze
- Create a ticketCreate a ticket
Class MessageServerConfiguration
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class MessageServerConfiguration < MessageConfiguration
attr_reader :jaas_config_path,
:server_properties_path, :server_properties_sample_path,
:ca_cert_srl_path, :ca_key_path, :cert_file_path, :cert_signed_path,
:keystore_files, :installed_files, :message_persistent_disk
- Create a ticketCreate a ticket
Class Certificate
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Certificate
STATUS_COMPLETE = :complete
# map `getcert status` return codes to something more descriptive
# 0 => :complete -- keys/certs generated
- Create a ticketCreate a ticket
Method run
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
Optimist.educate unless set_host? || key? || database? || db_dump? || db_backup? ||
db_restore? || tmp_disk? || log_disk? ||
uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
set_server_state? || set_replication? || openscap? ||
- Create a ticketCreate a ticket
Method ask_for_disk
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def ask_for_disk(disk_name, verify = true, silent = false)
require "linux_admin"
disks = LinuxAdmin::Disk.local.select { |d| d.partitions.empty? }
if disks.empty?
- Read upRead up
- Create a ticketCreate a ticket
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 configure_keystore
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure_keystore
say(__method__.to_s.tr("_", " ").titleize)
return if files_found?(keystore_files)
- Create a ticketCreate a ticket
Method disk_usage
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.disk_usage(file = nil)
file_arg = file
file_arg = "-l" if file.nil? || file == ""
unless file_arg == "-l" || File.exist?(file)
- Create a ticketCreate a ticket
Method ask_for_database_credentials
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ask_for_database_credentials(password_twice = true)
self.host = ask_for_ip_or_hostname("database hostname or IP address", host) if host.blank? || !local?
self.port = ask_for_integer("port number", nil, port) unless local?
self.database = just_ask("name of the database on #{host}", database) unless local?
self.username = just_ask("username", username) unless local?
- Create a ticketCreate a ticket
Method just_ask
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def just_ask(prompt, default = nil, validate = nil, error_text = nil, klass = nil)
ask("Enter the #{prompt}: ", klass) do |q|
q.readline = true
q.default = default.to_s if default
q.validate = validate if validate
- Read upRead up
- Create a ticketCreate a ticket
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_replication
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_replication
if options[:replication] == "primary"
db_replication = ManageIQ::ApplianceConsole::DatabaseReplicationPrimary.new
say("Configuring Server as Primary")
else
- Read upRead up
- Create a ticketCreate a ticket
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"