Showing 17 of 21 total issues
Method user_is_able_to_perform_action
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def user_is_able_to_perform_action
if signed_in?
unless @proposal.blank?
if @proposal.topic.location.is_user_subscribed?(current_user)
return "able"
- 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 user_is_able_to_perform_action
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def user_is_able_to_perform_action
if signed_in?
unless @proposal.blank?
if @proposal.topic.location.is_user_subscribed?(current_user)
return "able"
Function StateToggler
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.StateToggler = function() {
var storageKeyName = 'jq-toggleState';
// Helper object to check for words in a phrase //
Method perform
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(params)
location = Location.find(params[:location_id])
topic = location.topics.create!(
params.except(:proposals_attributes, :auto_split_text)
Method link_for_notification
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def link_for_notification(notification)
if notification.notifiable
case notification.notifiable_type
when 'Comment'
case notification.notifiable.commentable_type
- 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 show
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def show
if params[:locations]
locations_slugs = params[:locations].split('/').last(Location.max_ancestry_size)
locations_slugs.unshift(current_model.slug) if current_model.is_a? Location
locations_slugs.unshift('global') unless locations_slugs.first == 'global'
- 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
Function toggleMenuItem
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function toggleMenuItem($listItem) {
removeFloatingNav();
var ul = $listItem.children('ul');
Method consensus
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def consensus(include_suggested)
total_votes_minimum_percent = topic.location.total_votes_percent
agree_votes_minimum_percent = topic.location.agree_votes_percent
proposal = nil
- 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 recursive_location_path
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def recursive_location_path(location)
locations = location.parents
locations << location
url_params = []
subdomain = nil
- 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 invite_emails
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.invite_emails(emails, team, user)
emails = emails.split(',') unless emails.respond_to? :to_ary
emails = emails.map(&:strip)
team_invitations = []
- 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 search_form_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def search_form_url
if params[:controller] == 'locations' && (
params[:action] == 'show' ||
params[:action] == 'search_topics'
)
- 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 perform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform(params)
location = Location.find(params[:location_id])
topic = location.topics.create!(
params.except(:proposals_attributes, :auto_split_text)
- 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
Avoid too many return
statements within this method. Open
return "just_subscribed"
Avoid too many return
statements within this method. Open
return "not_able_to_subscribe"
Avoid too many return
statements within this method. Open
return "not_logged"
Method invite_emails
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.invite_emails(emails, user)
emails = emails.split(',') unless emails.respond_to? :to_ary
emails = emails.map(&:strip)
return false unless user.available_invitations.to_i >= emails.size
- 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 create_from_omniauth
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_from_omniauth
auth_hash = request.env['omniauth.auth']
authentication =
Authentication.find_by_provider_and_uid(
- 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"