Method update
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@user = User.find(params[:id])
if current_user != @user
authorize! :manage, User
end
Method update
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def update
@user = User.find(params[:id])
if current_user != @user
authorize! :manage, User
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
File users_controller.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
class UsersController < ApplicationController
require 'securerandom'
#before_filter :verify_authentication, :except => [:show, :create_inactive_user]
before_filter :load_data, :only => [:update, :edit, :new, :create, :create_inactive_user]
Method create
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create
authorize! :manage, User
set_page_title 'New 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 create_inactive_user
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_inactive_user
#No authorize required since everyone can ask for new account which will be validated by an Admin
unless (params[:email].blank? || params[:first_name].blank? || params[:last_name].blank? || params[:login_name].blank?)
user = User.where('login_name = ? OR email = ?', params[:login_name], params[:email]).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 create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
authorize! :manage, User
set_page_title 'New user'
Method send_feedback
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_feedback
# No authorize required since everyone can send a feedback if the feature have been enabled using the allow_feedback admin settings.
latest_record_version = Version.last.nil? ? Version.create(:comment => 'No update data has been save') : Version.last
@latest_repo_update = latest_record_version.repository_latest_update #Home::latest_repo_update
@latest_local_update = latest_record_version.local_latest_update
Method create_inactive_user
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_inactive_user
#No authorize required since everyone can ask for new account which will be validated by an Admin
unless (params[:email].blank? || params[:first_name].blank? || params[:last_name].blank? || params[:login_name].blank?)
user = User.where('login_name = ? OR email = ?', params[:login_name], params[:email]).first