Method new
has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring. Open
def new
begin
CodeReview.transaction {
@review = CodeReview.new
@review.issue = Issue.new
- 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 a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def show
@review = CodeReview.find(params[:review_id].to_i) unless params[:review_id].blank?
@repository = @review.repository if @review
@assignment = CodeReviewAssignment.find(params[:assignment_id].to_i) unless params[:assignment_id].blank?
@repository_id = @assignment.repository_identifier if @assignment
- 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 code_review_controller.rb
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
class CodeReviewController < ApplicationController
before_action :find_project, :authorize, :find_user, :find_setting, :find_repository, :find_priorities
helper :sort
include SortHelper
Method update_diff_view
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def update_diff_view
@show_review_id = params[:review_id].to_i unless params[:review_id].blank?
@show_review = CodeReview.find(@show_review_id) if @show_review_id
@review = CodeReview.new
@rev = params[:rev] unless params[:rev].blank?
- 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 assign
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def assign
code = {}
code[:action_type] = params[:action_type] unless params[:action_type].blank?
code[:rev] = params[:rev] unless params[:rev].blank?
code[:rev_to] = params[:rev_to] unless params[:rev_to].blank?
- 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 new
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new
begin
CodeReview.transaction {
@review = CodeReview.new
@review.issue = Issue.new
Method update_diff_view
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_diff_view
@show_review_id = params[:review_id].to_i unless params[:review_id].blank?
@show_review = CodeReview.find(@show_review_id) if @show_review_id
@review = CodeReview.new
@rev = params[:rev] unless params[:rev].blank?
Method show
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@review = CodeReview.find(params[:review_id].to_i) unless params[:review_id].blank?
@repository = @review.repository if @review
@assignment = CodeReviewAssignment.find(params[:assignment_id].to_i) unless params[:assignment_id].blank?
@repository_id = @assignment.repository_identifier if @assignment