Showing 88 of 112 total issues
Method dir2theme
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.dir2theme(dir)
theme = nil
Dir.chdir(File.join(Rails.root, THEME_ROOT)) do
theme_init_file = File.join(dir, "init.rb")
if File.exist? theme_init_file
- 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_select
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def simple_remote_select options
parsed_options = {}
parsed_options[:disabled] = 'disabled' if options[:disabled]
options[:id] = SecureRandom.hex(2) unless options[:id]
- 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_workgroup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_workgroup
sleep 2 if development?
@workgroup = Setting.find(params[:id]) if params[:id]
if @workgroup && @workgroup.name.eql?("workgroup")
params[:share][:value].strip!
- 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 set_locale
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_locale
preferred_locales = request.headers['HTTP_ACCEPT_LANGUAGE'].split(',').map { |locale| locale.split(';').first } rescue nil
available_locales = I18n.available_locales
default_locale = I18n.default_locale
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def before_save_hook
if guest_writeable_changed?
guest_writeable ? make_guest_writeable : make_guest_non_writeable
end
self.tags = self.tags.split(/\s*,\s*|\s+/).reject {|s| s.empty? }.join(', ').downcase if self.tags_changed?
- 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
Function tmpl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
tmpl: function( tmpl, data, options, parentItem ) {
var ret, topLevel = !parentItem;
if ( topLevel ) {
// This is a top-level tmpl call (not from a nested template using {{tmpl}})
parentItem = topTmplItem;
Function initialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function(options){
var _this = this;
var options = options || {};
Method set_platform
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_platform
if File.exist?('/etc/amahi-release')
line = nil
File.open("/etc/amahi-release", "r") do |issue|
line = issue.gets
Method destroy
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def destroy
sleep 2 if development?
@user = User.find(params[:id])
id = nil
if @user && @user != current_user && !@user.admin?
- 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_radio
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def simple_remote_radio 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 system_all_new_users
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def system_all_new_users
res = []
Dir.chdir("/home") do
Dir.glob("*").sort.reverse.each do |login|
unless User.where(:login=> login).first
- 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_theme
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def install_theme(installer, source)
return if (installer.source_url.nil? or installer.source_url.blank?)
dir = 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 hda
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def hda
@page_title = 'Search Results'
@search_value = 'HDA'
if params[:button] && params[:button] == "Web"
- 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 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.read_lease(file)
res = {}
return res unless File.exists?(file)
current = {}
File.foreach(file) do |l|
Method pkginstall
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def pkginstall(pkgs, sha1 = nil)
if debian? or ubuntu? or mint?
c = Command.new "DEBIAN_FRONTEND=noninteractive apt-get -y install #{pkgs}"
c.run_now
elsif fedora? or centos?
- 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 setup_router
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def setup_router
@router = nil
r = Setting.get_kind('network', 'router_model')
return @router unless r
begin
- 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 pkguninstall
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def pkguninstall(pkgs)
if debian? or ubuntu? or mint?
c = Command.new "DEBIAN_FRONTEND=noninteractive apt-get -y remove #{pkgs}"
c.run_now
elsif fedora? or centos?
- 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_system
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize_system
username = params[:username]
pwd = params[:password]
conf = params[:password_confirmation]
unless valid_admin_password?(pwd, conf)
- 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_pin
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_pin
sleep 2 if development?
@user = User.find(params[:id])
if(params[:user][:pin].blank? || params[:user][:pin_confirmation].blank?)
errors = 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 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"