Method show
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def show
@tag_groups = @work.tag_groups
if params[:view_adult]
cookies[:view_adult] = "true"
elsif @work.adult? && !see_adult?
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
def update
if params[:cancel_button]
# Not quite working yet - should send the user back to wherever they were before they hit edit
redirect_back_or_default(root_path)
return
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def create
if params[:cancel_button]
redirect_back_or_default(root_path)
return
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 show
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@tag_groups = @work.tag_groups
if params[:view_adult]
cookies[:view_adult] = "true"
elsif @work.adult? && !see_adult?
Method update
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
if params[:cancel_button]
# Not quite working yet - should send the user back to wherever they were before they hit edit
redirect_back_or_default(root_path)
return
Method post
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def post
if params[:cancel_button]
redirect_to @work
elsif params[:edit_button]
redirect_to [:edit, @work, @chapter]
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def destroy
if @chapter.is_only_chapter? || @chapter.only_non_draft_chapter?
flash[:error] = t(".only_chapter")
redirect_to(edit_work_path(@work))
return
- 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"