Method show
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def show
@user = User.find_by_username!(params[:username])
respond_to do |format|
format.html do
- 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 UsersController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class UsersController < ApplicationController
after_action :track_referrer, only: :show
skip_before_action :require_registration, only: [:edit, :update]
layout 'coderwallv2', only: :edit
File users_controller.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
class UsersController < ApplicationController
after_action :track_referrer, only: :show
skip_before_action :require_registration, only: [:edit, :update]
layout 'coderwallv2', only: :edit
Method edit
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def edit
respond_to do |format|
format.json do
settings
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
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update
user_id = params[:id]
@user = user_id.blank? ? current_user : User.find(user_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 user_update_params
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def user_update_params
params.require(:user).permit(:about,
:avatar,
:avatar_cache,
:banner,
Method show
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@user = User.find_by_username!(params[:username])
respond_to do |format|
format.html do
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
@user = User.for_omniauth(oauth)
ucp = user_create_params.dup
- 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"