Class ApplicationController
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :authenticate_user!
File application_controller.rb
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :authenticate_user!
Method session_expired?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def session_expired?
unless load_admin_setting('session_maximum_lifetime')=='unset'
setting_session_maximum_lifetime = load_admin_setting('session_maximum_lifetime').to_i*60*60*24
unless session[:ctime] && (Time.now.utc.to_i - session[:ctime].to_i <= setting_session_maximum_lifetime)
return 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 redirect_save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def redirect_save(url, anchor=nil)
begin
if anchor.nil?
(params[:commit] == "#{I18n.t 'save'}" or params[:commit] == 'Save') ? url : session[:return_to]
else
- 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_current_project
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_current_project
begin
if params[:project_id].present? && !params[:project_id].nil?
session[:project_id] = params[:project_id]
@project = Project.find(params[:project_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 set_current_organization
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_current_organization
begin
#Si ya un parametre
if params[:organization_id].present?
session[:organization_id] = params[:organization_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 current_module_project
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def current_module_project
@defined_record_status = RecordStatus.find_by_name('Defined')
pemodule = Pemodule.find_by_alias_and_record_status_id('initialization', @defined_record_status)
default_current_module_project = ModuleProject.where('pemodule_id = ? AND project_id = ?', pemodule.id, @project.id).first
if @project.module_projects.map(&:id).include?(session[:module_project_id].to_i)
- 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 current_balancing_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def current_balancing_attribute
@defined_record_status = RecordStatus.find_by_name('Defined')
begin
@default_balancing_attribute = current_module_project.pemodule.pe_attributes.where('alias = ?', Projestimate::Application::EFFORT).defined.last
if current_module_project.pemodule.alias == Projestimate::Application::BALANCING_MODULE
- 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 after_sign_in_path_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def after_sign_in_path_for(resource)
# return the path based on resource
if resource.password_changed
# if user has no organization, this means that his has no group, so no right
if resource.organizations.where(is_image_organization: false).size == 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 current_component
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def current_component
if @project
begin
pbs = PbsProjectElement.find(session[:pbs_project_element_id])
if pbs.pe_wbs_project.project_id == @project.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"