Class TaskFilter
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class TaskFilter < ActiveRecord::Base
# column `name` is of type `VARCHAR(255)`.
# Note that MySQL 5.x+ and PostgreSQL both track length of "characters" and not "bytes"
MAXIMUM_NAME_LENGTH = 255
File task_filter.rb
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
class TaskFilter < ActiveRecord::Base
# column `name` is of type `VARCHAR(255)`.
# Note that MySQL 5.x+ and PostgreSQL both track length of "characters" and not "bytes"
MAXIMUM_NAME_LENGTH = 255
Method generate_name
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def generate_name
counter = 0
arr=[]
types=['Project', 'Milestone', 'Status', 'Client', 'User']
types.each do |type|
- 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 column_name_for
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def column_name_for(class_type)
if class_type == 'User'
return "task_users.type= 'TaskOwner' AND task_users.user_id"
elsif class_type == 'Project'
return 'tasks.project_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
Avoid too many return
statements within this method. Open
return 'tasks.company_id'
Avoid too many return
statements within this method. Open
return "#{ class_type.downcase }_id"
Avoid too many return
statements within this method. Open
return 'tasks.milestone_id'
Avoid too many return
statements within this method. Open
return 'task_tags.tag_id'
Method compose_sql
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def compose_sql(arg1, arg2)
if arg1.blank?
if arg2.blank?
''
else
- 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"