Showing 88 of 112 total issues
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize
@file = '/etc/mtab'
@info = []
begin
f = File.open('/etc/mtab')
- 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 service_start_command
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def service_start_command(name)
service = service_name(name)
if fedora? or arch? or centos?
"/usr/bin/systemctl start #{service}.service"
elsif ubuntu? and File.exist?(UPSTART_CONF % service)
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
nm = params[:name]
path = params[:path]
if nm.nil? or nm.blank? or ((not (valid_name?(nm))) or (nm.size > 32) or (path.size > 64))
flash.now[:error] = "Bad share 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 service_enable_command
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def service_enable_command(name)
service = service_name(name)
if fedora? or arch? or centos?
"/usr/bin/systemctl enable #{service}.service"
elsif ubuntu? and File.exist?(UPSTART_CONF % service)
- 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_webapp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def install_webapp(installer, source)
name = webapp_name(installer.url_name)
path = WEBAPP_PATH % 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 service_stop_command
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def service_stop_command(name)
service = service_name(name)
if fedora? or arch? or centos?
"/usr/bin/systemctl stop #{service}.service"
elsif ubuntu? and File.exist?(UPSTART_CONF % service)
- 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 simple_remote_checkbox
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def simple_remote_checkbox options
parsed_options = {}
parsed_options[:checked] = 'checked' if options[:checked]
parsed_options[:disabled] = 'disabled' if options[:disabled]
- 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 update_pubkey
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_pubkey
sleep 2 if development?
@user = User.find(params[:id])
# sleep a little to see the spinner working well
unless @user
- 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 valid_address?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def valid_address?(addr)
return false if addr.nil?
# NOTE: do not allow aliases to the hda as a blank address
return false if addr.blank?
return false unless (addr =~ VALID_ADDRESS)
- 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 service_disable_command
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def service_disable_command(name)
service = service_name(name)
if fedora? or arch? or centos?
"/usr/bin/systemctl enable #{service}.service"
elsif ubuntu? and File.exist?(UPSTART_CONF % service)
- 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_lease
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.read_lease(file)
res = []
return res unless File.exists?(file)
current = {}
File.foreach(file) do |line|
- 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 before_save_hook
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def before_save_hook
if monitored_changed?
monitored ? monit_file_add : monit_file_remove
# DEBUG RAILS_DEFAULT_LOGGER.info "* * * MONITORED CHANGED to #{monitored}"
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
Consider simplifying this complex logical expression. Open
if params[:button] && params[:button] == "Web"
require 'uri'
redirect_to URI.escape("http://www.google.com/search?q=#{params[:query]}")
else
@query = params[:query]
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(controller, label, url, parent = nil, advanced = false)
Method update_address
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_address
a = DnsAlias.find(params[:id])
addr = params[:value].strip
# FIXME - report errors to the user!
unless valid_address?(addr)
- 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 toggle_disk_pool_partition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def toggle_disk_pool_partition
path = params[:path]
part = DiskPoolPartition.where(:path=>path).first
if part
# was enabled - disable it by deleting it
- 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 download_direct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.download_direct(url)
redirect_limit = 5
while redirect_limit > 0
- 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 locate_cache
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def locate_cache(term)
FileUtils.mkdir_p(SEARCH_CACHE)
sha1 = Digest::SHA1.hexdigest(term)
cache = File.join(SEARCH_CACHE, sha1)
# expire old entries in the cache to prevent accumulation (12 hours, index is 24 hours old)
- 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 too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return true