app/models/note.rb
Class Note
has 55 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Note < ActiveRecord::Base
include NoteCustom, Syncable
attr_writer :tag_list, :instruction_list, :keyword_list
attr_accessor :external_created_at
- Create a ticketCreate a ticket
File note.rb
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class Note < ActiveRecord::Base
include NoteCustom, Syncable
attr_writer :tag_list, :instruction_list, :keyword_list
attr_accessor :external_created_at
- Create a ticketCreate a ticket
Method discard_versions?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def discard_versions?
if has_instruction?('reset')
self.external_updated_at = external_created_at if NB.always_reset_on_create == 'true'
versions.destroy_all unless versions.empty?
end
- Read upRead up
- Create a ticketCreate a ticket
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_new_version?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def save_new_version?
return false unless content_type == 'note'
return false if external_updated_at_was.blank?
return false if external_updated_at == external_updated_at_was
NB.versions == 'true' && ((external_updated_at - external_updated_at_was) > NB.version_gap_minutes.to_i.minutes || get_real_distance > NB.version_gap_distance.to_i)
- Read upRead up
- Create a ticketCreate a ticket
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"