Method update_it
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def update_it
dashboard_json = ActiveSupport::JSON.decode(params["dashboards"]) if params["dashboards"]
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"
Further reading
Method destroy
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def destroy
def render_error(msg, status=400, errors=nil)
render :json => {:success => false, :msg => msg, :errors => errors }, :status => status
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 update_it
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_it
dashboard_json = ActiveSupport::JSON.decode(params["dashboards"]) if params["dashboards"]
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?
Method show
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def show
respond_to do |format|
format.html do
DashboardController.app_toolbar "application"
expire_fragment(:controller => "dashboard", :action => "index") if DashboardController.expired?
- 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 index
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def index
user = params[:user_id] ? User.find(params[:user_id]) : current_user
respond_to do |format|
format.json do
for_admin = params[:for_admin].to_s == "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 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"
Further reading
Method hud
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def hud
DashboardController.app_toolbar "han"
@user = current_user
require 'will_paginate/array'
per_page = ( params[:per_page].to_i > 0 ? params[:per_page].to_i : 10 )
- 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 menu
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def menu
@report_menu = "{name: 'Reports', tab:{id: 'reports', title:'Reports', initializer: 'Talho.Reports'}}" if current_user.has_non_public_role?
plugin_config_items = []
$menu_config.each do |app, val|
- 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"