Method get_formatted_shares
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.get_formatted_shares(current_user)
shares = []
Folder.each_with_level(current_user.shares.order(:user_id, :organization_id, :lft)) do |share, level|
share.is_owner = share.owner?(current_user)
share.is_author = share.author?(current_user)
- 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 attributes=
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def attributes= (attributes)
shared_attr = attributes[:shared]
attributes.delete(:shared)
audience_attr = attributes[:audience]
attributes.delete(:audience)
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.new( attributes = {}, options = {} )
shared_attr = attributes[:shared]
attributes.delete(:shared)
audience_attr = attributes[:audience]
attributes.delete(:audience)
- 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 permissions=
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def permissions= (permission_attributes)
permission_attributes = JSON.parse(permission_attributes) if(permission_attributes.class == String)
possible_removed_permissions = permission_attributes.select { |x| x['permission'] == 0 }
permission_attributes.reject! { |x| x['permission'] == 0 }
- 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 permissions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def permissions
perms = folder_permissions
if share_status == 'inherited'
#find the parent that we have inherited from
folder = parent
- 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"