Showing 4 of 8 total issues
Function Scroll
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Scroll = (function() {
let instance = undefined;
Scroll = class Scroll {
static initClass() {
instance = null;
Method generate_preview
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def generate_preview
website = LinkThumbnailer.generate(uri)
video = website.videos.find { |v| v.embed_code.present? }
if video
- 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 like_link
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def like_link(topic)
if signed_in?
if topic.user == current_user
button_to t('topic.edit'), edit_topic_path(topic), method: :get, class: 'btn btn-primary'
elsif like = topic.already_liked?(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 participation_link
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def participation_link(event, link_class: 'btn btn-primary')
if signed_in?
if current_user.participates?(event)
link_to t('show.not_attend'), [event, current_user.participation(event)], method: :delete, class: link_class
elsif event.closed?
- 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"