Showing 106 of 147 total issues
Function removeTag
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
removeTag: function(tag, animate) {
animate = typeof animate === 'undefined' ? this.options.animate : animate;
tag = $(tag);
Method create_photos
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_photos
@photo = current_user.photos.new
file = params[:qqfile] ||params[:upload]
@photo.photo = Ckeditor::Http.normalize_param(file, request)
callback = ckeditor_before_create_asset(@photo)
Method update
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@metro_areas, @states = setup_locations_for(@user)
unless params[:metro_area_id].blank?
@user.metro_area = MetroArea.find(params[:metro_area_id])
Method update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update
@event = Event.find(params[:id])
if params[:metro_area_id]
@event.metro_area = MetroArea.find(params[:metro_area_id])
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 get_sorted_langs_from_accept_header
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_sorted_langs_from_accept_header
accept_langs = (request.env['HTTP_ACCEPT_LANGUAGE'] || "en-us,en;q=0.5").split(/,/) rescue nil
return nil unless accept_langs
# Extract langs and sort by weight
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
@event = Event.new(event_params)
@event.user = current_user
if params[:metro_area_id]
@event.metro_area = MetroArea.find(params[:metro_area_id])
- 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 build_conditions_for_search
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.build_conditions_for_search(search)
user = User.arel_table
users = User.active
if search['country_id'] && !(search['metro_area_id'] || search['state_id'])
users = users.where(user[:country_id].eq(search['country_id']))
- 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 get_plugins_to_migrate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_plugins_to_migrate(plugin_names)
# First, grab all the plugins which exist and have migrations
@plugins_to_migrate = if plugin_names.empty?
Desert::Manager.plugins
- 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 delete_selected
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_selected
if request.post?
if params[:delete]
params[:delete].each { |id|
@message = Message.where("messages.id = ? AND (sender_id = ? OR recipient_id = ?)", id, @user, @user).first
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
@user = current_user
@invitation = Invitation.new(invitation_params)
@invitation.user = @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
Avoid deeply nested control flow statements. Open
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
Method create_photos
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_photos
@photo = current_user.photos.new
file = params[:qqfile] ||params[:upload]
@photo.photo = Ckeditor::Http.normalize_param(file, request)
callback = ckeditor_before_create_asset(@photo)
- 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 find_user
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_user
if @user = User.active.find(params[:user_id] || params[:id])
@is_current_user = (@user && @user.eql?(current_user))
unless logged_in? || @user.profile_public?
flash[:error] = :private_user_profile_message.l
- 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
Consider simplifying this complex logical expression. Open
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
do {
backgroundColor = jQuery.curCSS( curElem, "backgroundColor" );
} while (
Function remove
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
Function add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
jQuery.event.add = function( elem, types, handler, data, selector ){
Method post_recommendation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def post_recommendation(name, email, post, message = nil, current_user = nil)
Method create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
@album = Album.new(album_params)
@album.user_id = current_user.id
respond_to do |format|
- 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 require_ownership_or_moderator
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def require_ownership_or_moderator
@rsvp = @event.rsvps.find(params[:id])
@user = @rsvp.user
unless admin? || moderator? || (@rsvp && (@user.eql?(current_user)))
redirect_to [@event] and return false
- 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 acts_as_activity
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def acts_as_activity(actor, options = {})
unless included_modules.include? InstanceMethods
after_create do |record|
unless options[:if].kind_of?(Proc) and not options[:if].call(record)
record.create_activity_from_self
- 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"