Showing 25 of 25 total issues
Class has too many lines. [451/250] Open
class DoryBin < Thor
class_option :verbose, type: :boolean, aliases: 'v', default: false
desc 'upgrade', 'Upgrade dory to the latest version'
long_desc <<-LONGDESC
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [51/30] Open
def exec_down(options, services)
services = sanitize_services(services)
return unless services
puts "Reading settings file at '#{Dory::Config.filename}'".green if options[:verbose]
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class Dnsmasq
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Dnsmasq
extend Dory::DockerService
#
# I really hate these globals. It would be great to refactor these out
Method has too many lines. [40/30] Open
def exec_up(options, services)
services = sanitize_services(services)
return unless services
puts "Reading settings file at '#{Dory::Config.filename}'".green if options[:verbose]
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for exec_down is too high. [16/6] Open
def exec_down(options, services)
services = sanitize_services(services)
return unless services
puts "Reading settings file at '#{Dory::Config.filename}'".green if options[:verbose]
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for exec_up is too high. [15/6] Open
def exec_up(options, services)
services = sanitize_services(services)
return unless services
puts "Reading settings file at '#{Dory::Config.filename}'".green if options[:verbose]
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [35/30] Open
def exec_ip(service, _options)
s = sanitize_service(service)
mod = if s == 'proxy'
Dory::Proxy
elsif s == 'dns'
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [33/30] Open
def exec_upgrade(_options)
puts "Checking if dory has updates available...".green
new_version = Dory::Upgrade.new_version
if new_version
if Dory::Upgrade.outdated?(new_version)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for exec_ip is too high. [9/6] Open
def exec_ip(service, _options)
s = sanitize_service(service)
mod = if s == 'proxy'
Dory::Proxy
elsif s == 'dns'
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for exec_status is too high. [8/6] Open
def exec_status(_options)
puts "Reading settings file at '#{Dory::Config.filename}'".green if options[:verbose]
settings = Dory::Config.settings
if Dory::Proxy.running?
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for exec_pull is too high. [8/6] Open
def exec_pull(services, _options)
servs = services.empty? ? %w[proxy dns] : services
servs = sanitize_services(servs)
return unless servs
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for upgrade is too high. [7/6] Open
def self.upgrade(old_hash)
newsettings = old_hash.dup
# If there's a single domain and address, upgrade to the array format
if newsettings[:dory][:dnsmasq][:domain]
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for exec_attach is too high. [7/6] Open
def exec_attach(service, _options)
s = sanitize_service(service)
mod = if s == 'proxy'
Dory::Proxy
elsif s == 'dns'
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for run_preconditions is too high. [7/6] Open
def self.run_preconditions
puts "[DEBUG] dnsmasq service running preconditions" if Dory::Config.debug?
# we don't want to hassle the user with checking the port unless necessary
if first_attempt_failed?
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method run_preconditions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.run_preconditions
puts "[DEBUG] dnsmasq service running preconditions" if Dory::Config.debug?
# we don't want to hassle the user with checking the port unless necessary
if first_attempt_failed?
- 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 upgrade
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.upgrade(old_hash)
newsettings = old_hash.dup
# If there's a single domain and address, upgrade to the array format
if newsettings[:dory][:dnsmasq][:domain]
- 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 down_systemd_services
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.down_systemd_services
puts "[DEBUG] Putting systemd services down" if Dory::Config.debug?
conf = if ask_about_killing?
puts "You have some systemd services running that will race against us \n" \
- 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 up_systemd_services
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.up_systemd_services
if self.systemd_services?
puts "[DEBUG] Putting systemd services back up: #{self.systemd_services.join(', ')}" if Dory::Config.debug?
if self.systemd_services.reverse.all? { |service|
Dory::Systemd.set_systemd_service(service: service, up: 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 handle_error
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.handle_error(_command_output)
puts "[DEBUG] handling dnsmasq start error" if Dory::Config.debug?
# If we've already tried to handle failure, prevent infinite recursion
if first_attempt_failed?
puts "[DEBUG] Attempt to kill conflicting service failed" if Dory::Config.debug?
- 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 offer_to_kill
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.offer_to_kill(listener_list, answer: nil)
listener_list.each do |process|
puts "Process '#{process.command}' with PID '#{process.pid}' is listening on #{process.node} port #{self.port}.".yellow
end
pids = listener_list.uniq(&:pid).map(&:pid)
- 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"