Showing 3,486 of 3,486 total issues
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
I18n.locale = "#{I18n.locale}_signup_create"
@selected_role = params[:role_id]
@selected_jurisdiction = params[:user][:home_jurisdiction_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
Avoid deeply nested control flow statements. Open
if ( item === SYM_WAIT || item === SYM_READY ) {
if ( item === SYM_READY ) {
current[ STR_PUSH ]( ready );
}
Function handleError
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
handleError: function(proxy, type, action, options, response, arg){
Avoid deeply nested control flow statements. Open
if options[:Delivery][:Providers][:override]
options[:Delivery][:Providers][:override].call(providers)
else
(self.alert_device_types.map{|device| device.device_type.display_name} || Service::Swn::Message::SUPPORTED_DEVICES.keys).each do |device|
device_options = {:name => "swn", :device => device}
Avoid deeply nested control flow statements. Open
if ( subFunctors[ STR_PLUS ] && isString( data ) ) {
if ( subFunctors[ STR_PLUS ] !== plus ) {
plus = subFunctors[ STR_PLUS ];
accu = accumulator( plus );
Method is_org_member_of?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def is_org_member_of?(other)
if other.class == Organization
return true if other.members.include?(self)
elsif other.class == Array || other.class == ActiveRecord::Relation
other.each do |org|
- 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 build_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_options(params)
# map EXT params to Sphinx params
if params[:limit].present?
params[:per_page] = params.delete(:limit)
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 deactivate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def deactivate
user_ids = params[:users][:user_ids].reject{|u| ["",current_user.id.to_s].include? u } # avoid current user deleting self
@users = user_ids.present? ? User.find_all_by_id(user_ids) : []
if @users.empty?
flash[:error] ||= ""
- 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 deeply nested control flow statements. Open
if ( ! --cssPollingNb ) {
return FALSE;
}
Method admin_users
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def admin_users
start = (params[:start] || 0).to_i
limit = (params[:limit] || 50).to_i
page = (start / limit).floor + 1
sort = params[:sort]
- 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
begin
report_class = params[:report].constantize
throw "You must select a report" unless report_class.superclass == Report
rescue
- 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 build_ivr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_ivr(message_hash)
msg = []
if @ivr.nil?
begin
message_name = message.Behavior.Delivery.Providers.select{|p| p.device == 'E-mail'}.first.Messages.select{|m| m.name == "message"}.first.ref
- 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 find_invitees
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_invitees
params[:dir] ||= 'DESC'
params[:sort] = params[:sort] ? params[:sort].underscore : 'name'
params[:per_page] = params[:limit].to_i || 20
- 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 get_text_response
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_text_response(resp, message_hash)
unless resp.ref.blank?
if message_hash[resp.ref]
return message_hash[resp.ref][:value] if message_hash[resp.ref][:value]
return message.Messages.select{|m| m.name == message_hash[resp.ref][:ref]}.first.Value unless message_hash[resp.ref][:ref].blank? # check for blank as m.name will never be blank
- 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 approve!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def approve!(approving_user)
unless RoleMembership.already_exists?(user, role, jurisdiction)
self.approver=approving_user
create_role_membership(:user => user, :role => role, :jurisdiction => jurisdiction)
if self.save
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def update
success = true
error_messages = []
user_list = ActiveSupport::JSON.decode(params[:batch][:users])
- 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 deeply nested control flow statements. Open
if ( isString( item ) ) {
item = {
url: url
};
Avoid deeply nested control flow statements. Open
if ( item[ STR_CALL ]( context , callback , thread ) !== FALSE ) {
callback();
}
Method app_toolbar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.app_toolbar(toolbar=nil, options = {} )
if toolbar.blank?
toolbar_partial = @toolbar.blank? ? self.controller_name : @toolbar
@toolbar = "application"
view_paths.each do |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 edit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def edit
respond_to do |format|
format.json do
dashboard = Dashboard.with_user(current_user).with_roles('publisher', 'editor').find_by_id(params[:id])
dashboard = Dashboard.find_by_id_and_application_default(params[:id], true) if current_user.is_super_admin? && dashboard.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"