Showing 5 of 114 total issues
Class CaseFilePresenter
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class CaseFilePresenter
include ActionView::Helpers::NumberHelper
include ActionView::Helpers::TextHelper
Function sort
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
sort: function(th, direction) {
var start = new Date(),
self = this,
table = this.$table,
//body = table.find('tbody').length > 0 ? table.find('tbody') : table,
Method case_must_have_client_and_employer_and_agency
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def case_must_have_client_and_employer_and_agency
errors.add(:case_file, 'must have a client') unless @case_file.client
errors.add(:case_file, 'must have an employer') unless @case_file.employer
if @case_file.case_type == 'Domestic'
errors.add(:case_file, 'must have an agency') unless @case_file.agency
- 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 save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save
if valid?
case_file.transaction do
unless involvement.involvable_id
involvement.involvable = involvable
- 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 perform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def perform
if valid?
@case_files = CaseFile.where(reported_at: start_date..end_date)
@case_files = @case_files.where(case_type: case_type) if case_type.present?
@case_files = @case_files.where(status: status) if status.present?
- 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"