Showing 9 of 12 total issues
Function loadFlash
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var loadFlash = function() {
var animationEnd = whichAnimationEvent();
var mainFlashNode = document.getElementById('main-flash');
var flashBackDrop = document.createElement("div");
- Create a ticketCreate a ticket
Function initDropdowns
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initDropdowns = function() {
function whichTransitionEvent(){
var t;
var el = document.createElement('fakeelement');
- Create a ticketCreate a ticket
Function initChangeImageColor
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initChangeImageColor = function() {
var elements = document.querySelectorAll('.pk-js-changed-color-images');
for(var i = 0; i < elements.length; i++) {
var elem = elements[i];
- Create a ticketCreate a ticket
Method attend_event_link
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def attend_event_link(event, visit_request)
return unless current_user
return if visit_request&.pending?
return if visit_request&.approved?
- 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
Avoid too many return
statements within this method. Open
return if event.visitors.include?(current_user)
- Create a ticketCreate a ticket
Method expect_an_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def expect_an_error(hash_pair = {}, nope = false) # rubocop:disable Metrics/AbcSize
field = hash_pair.keys.first
value = hash_pair.values.first
error_div = "div.#{field}.field_with_errors"
- 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 expect_an_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def expect_an_error(hash_pair = {}, nope = false) # rubocop:disable Metrics/AbcSize
field = hash_pair.keys.first
value = hash_pair.values.first
error_div = "div.#{field}.error"
- 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 visit_request_confirm_message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def visit_request_confirm_message(visit_request)
return unless visit_request && current_user
if visit_request.confirmed?
t('visit_requests.messages.see_you')
- 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 call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def call # rubocop:disable Metrics/AbcSize
return VisitRequest::Approve.call(visit_request) if user.verified? && policy.free_slot_for?(user)
VisitRequestMailer.needs_confirmation(visit_request).deliver_later unless user.verified?
visit_request.pending!
- 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"