Showing 112 of 112 total issues
Method conf_file
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def conf_file
# clean the path first
path.sub!(/\/+$/, '')
path.gsub!(/\/+/, '/')
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
Class Server
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < ApplicationRecord
# CAUTION - this class *assumes* new servers are created
# started and enabled at boot time as services!
Method stats
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def stats
host = 'localhost'
port = 7634
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
Class NetworkController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class NetworkController < ApplicationController
KIND = Setting::NETWORK
before_action :admin_required
before_action :set_page_title
IP_RANGE = 10
Method available
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.available
tl = all.to_a
Dir.chdir(File.join(Rails.root, THEME_ROOT)) do
Dir.glob("*").sort.each do |theme_dir|
next if where(:css=>theme_dir).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
Function storeTmplItems
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function storeTmplItems( content ) {
var keySuffix = "_" + cloneIndex, elem, elems, newClonedItems = {}, i, l, m;
for ( i = 0, l = content.length; i < l; i++ ) {
if ( (elem = content[i]).nodeType !== 1 ) {
continue;
Method run_script
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.run_script(script, name, environment = {})
require 'tempfile'
include Process
# number of linear backoff steps to wait. 22 ~= 160s
- 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
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update
sleep 2 if development?
user = User.find params[:id]
name = user.name
if can_i_edit_details?(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 conf_file
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def conf_file
# clean the path first
path.sub!(/\/+$/, '')
path.gsub!(/\/+/, '/')
domain = ''
Method header_workgroup
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.header_workgroup(domain)
short_domain = Setting.find_or_create_by(Setting::GENERAL, 'workgroup', 'WORKGROUP').value
debug = Setting.shares.value_by_name('debug') == '1'
win98 = Setting.shares.value_by_name('win98') == '1'
ret = ["# This file is automatically generated for WORKGROUP setup.",
Method estimate_pids
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def estimate_pids
pf = pid_file
ret = []
begin
# check if the pid file is there
- 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 uninstall_bg
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def uninstall_bg
if Rails.env=="production"
cmd = Command.new("chmod 666 /var/run/docker.sock")
cmd.execute
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
Method uninstall_bg
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def uninstall_bg
if Rails.env=="production"
cmd = Command.new("chmod 666 /var/run/docker.sock")
cmd.execute
end
Method stats
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stats
host = 'localhost'
port = 7634
begin
Method share_conf
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def share_conf
ret = "[%s]\n" \
"\tcomment = %s\n" \
"\tpath = %s\n" \
"\twriteable = %s\n" \
Function buildTmplFn
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildTmplFn( markup ) {
return new Function("jQuery","$item",
// Use the variable __ to hold a string array while building the compiled template. (See https://github.com/jquery/jquery-tmpl/issues#issue/10).
"var $=jQuery,call,__=[],$data=$item.data;" +
Function processItemKey
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processItemKey( el ) {
var pntKey, pntNode = el, pntItem, tmplItem, key;
// Ensure that each rendered template inserted into the DOM has its own template item,
if ( (key = el.getAttribute( tmplItmAtt ))) {
while ( pntNode.parentNode && (pntNode = pntNode.parentNode).nodeType === 1 && !(pntKey = pntNode.getAttribute( tmplItmAtt ))) { }
Method platform_versions
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def platform_versions
platform = ""
hda_ctl = ""
if fedora? or centos?
open("|rpm -q hda-platform hda-ctl") do |f|
Method run_script
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.run_script(script, name, environment = {})
require 'tempfile'
include Process
# number of linear backoff steps to wait. 22 ~= 160s
Method initialize_system
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize_system
username = params[:username]
pwd = params[:password]
conf = params[:password_confirmation]
unless valid_admin_password?(pwd, conf)