Showing 66 of 90 total issues
Avoid too many return
statements within this method. Open
return false
Method get_content
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_content
if self.page.exists?
if self.page.content.kind_of?(Hash) and value = self.page.content['content']
return value
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"
Further reading
Method snippet_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def snippet_for(slug, use_simple_format=true)
record = snippet_record_for(slug)
string = record.content
if admin?
if matcher = string.match(%r{(.+)(</(?:div|p)>)\s*$}s)
- 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 validate_url_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_url_attribute(*attributes)
valid = true
for attribute in [attributes].flatten
value = self.read_attribute(attribute)
next if value.blank?
- 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 overlaps?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def overlaps?(object)
raise ArgumentError unless object.respond_to?(:start_time) && object.respond_to?(:end_time)
if self.start_time != self.end_time && object.start_time != object.end_time
(self.start_time.to_i..self.end_time.to_i).overlaps?(object.start_time.to_i..object.end_time.to_i) && (self.end_time != object.start_time && self.start_time != object.end_time)
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"
Further reading
Method assert_accepting_proposals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assert_accepting_proposals
unless accepting_proposals? || admin?
flash[:failure] = Snippet.content_for(:proposals_not_accepted_error)
redirect_to @event ? event_proposals_path(@event) : proposals_path
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"