Showing 24 of 32 total issues
File capistrano.rb
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'yaml'
require 'capistrano/recipes/deploy/scm'
require 'capistrano/recipes/deploy/strategy'
def _cset(name, *args, &block)
Method reopen_logs
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def reopen_logs
nr = 0
append_flags = File::WRONLY | File::APPEND
DaemonKit.logger.info "Rotating logs" if DaemonKit.logger
- 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
Class AbstractLogger
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractLogger
attr_accessor :copy_to_stdout
@severities = {
File initializer.rb
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'pathname'
DAEMON_ENV = (ENV['DAEMON_ENV'] || 'development').dup unless defined?(DAEMON_ENV)
# Absolute paths to the daemon_kit libraries added to $:
Method configuration
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def configuration( argv )
configs = []
i = 0
while i < argv.size
- 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 stop
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def stop
@pid_file = PidFile.new( DaemonKit.configuration.pid_file( DaemonKit.configuration.instance ) )
unless @pid_file.running?
@pid_file.cleanup
- 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 initialize
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@options = {}
@parser = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [command] [options]"
Method configuration
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configuration( argv )
configs = []
i = 0
while i < argv.size
Method stop
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stop
@pid_file = PidFile.new( DaemonKit.configuration.pid_file( DaemonKit.configuration.instance ) )
unless @pid_file.running?
@pid_file.cleanup
Method parse_arguments!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_arguments!
return unless own_args?
configs = Arguments.configuration( ARGV ).first
@unused_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 shutdown
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.shutdown( clean = false, do_exit = false )
return unless $daemon_kit_shutdown_hooks_ran.nil?
$daemon_kit_shutdown_hooks_ran = true
DaemonKit.logger.info "Running shutdown hooks"
- 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 initialize_logger
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize_logger
return if DaemonKit.logger
unless logger = configuration.logger
logger = AbstractLogger.new( configuration.log_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 process
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process( transport, from, workitem )
# keep it singleton
@instance ||= new
work = parse( workitem )
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize
@config = DaemonKit::Config.load('xmpp')
if @config.enable_logging
Blather.logger = DaemonKit.logger
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def help
namespaces = constants.inject([]) do |list, sym|
unless sym == :Base || sym == :AppGenerator
klass = const_get( sym )
list << klass.namespace if klass.respond_to?( :namespace )
- 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 trap
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def trap( signal, proc = nil, &block )
return if proc.nil? && !block_given?
# One step towards running on windows, not enough though
unless Signal.list.include?( signal )
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize( *args )
super
unless INSTALLERS.include?( options[:installer] )
raise Error, "Invalid value for --installer option. Supported installers are: #{INSTALLERS.join(', ')}"
- 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 try_sudo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def try_sudo(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
command = args.shift
raise ArgumentError, "too many arguments" if args.any?
- 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 logger=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def logger=( logger )
if logger.is_a?( Symbol )
@backend = logger
@logger.close rescue nil
@logger = create_logger
- 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 drop_privileges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def drop_privileges
if DaemonKit.configuration.group
begin
group = Etc.getgrnam( DaemonKit.configuration.group )
Process::Sys.setgid( group.gid.to_i )
- 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"