Showing 36 of 117 total issues
Method index
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def index
options = {}
if ranking.present?
options[:json] = if params[:user_id].present? || params[:user_name].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"
Further reading
Method set_project_defaults
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_project_defaults(attributes)
attributes[:user_id] ||= @me.id if @me && !attributes[:user_id]
attributes[:product_id] ||= @product.id if @product && !attributes[:product_id]
attributes[:area_ids] ||= [Area.last.id] if Area.any? && !attributes[:area_ids]
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 set_vacancy_defaults
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_vacancy_defaults(attributes)
attributes[:user_id] ||= @me.id unless attributes[:user_id] || !@me
attributes[:project_id] ||= Project.last.id unless attributes[:project_id] || Project.all.none?
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
Function removeRelationshipChangeFor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
removeRelationshipChangeFor: function(clientReference, childKey, parentReference, parentKey, type) {
Function addRelationshipChangeFor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
addRelationshipChangeFor: function(clientReference, childKey, parentReference, parentKey, change) {
Function extractEmbeddedHasMany
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
extractEmbeddedHasMany: function(loader, relationship, array, parent, prematerialized) {
Function extractEmbeddedBelongsTo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
extractEmbeddedBelongsTo: function(loader, relationship, data, parent, prematerialized) {
Function dirtyRecordsForAttributeChange
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
dirtyRecordsForAttributeChange: function(dirtySet, record, attributeName, newValue, oldValue) {
Function relationshipChangeFor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
relationshipChangeFor: function(clientReference, childKey, parentReference, parentKey, type) {
Method up
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def up
add_column :vacancies, :resource_type, :string
add_column :vacancies, :resource_id, :integer
if (Product::Recruiting rescue nil)
- 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 function. Open
return DS.OneToOneChange.createChange(firstRecordReference, secondRecordReference, store, options);
Avoid too many return
statements within this function. Open
return DS.ManyToManyChange.createChange(firstRecordReference, secondRecordReference, store, options);
Avoid too many return
statements within this function. Open
return store.findById(belongsTo.type, belongsTo.id);
Method down
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def down
add_column :vacancies, :user_id, :integer
if (Product::Recruiting rescue nil)
Vacancy.where('resource_type = "User"').update_all('user_id = resource_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 up
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def up
Product.each do |product|
next if product.klass_name.present?
if product.name == 'Product'
- 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 thing=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def thing=(thing)
thing.save if thing.new_record?
self.thing_id = thing.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"