Showing 857 of 1,207 total issues
Method after_update
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def after_update
users = []
admins = []
if self.saved_change_to_edited_at? || (self.saved_change_to_unreviewed? && !self.unreviewed?)
- 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 collect_update_multiple_results
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def collect_update_multiple_results
TagSet::TAG_TYPES_INITIALIZABLE.each do |tag_type|
@approve[tag_type] = []
@synonym[tag_type] = []
@reject[tag_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 index
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def index
base_options = {
page: params[:page] || 1,
show_restricted: current_user.present? || logged_in_as_admin?
}
- 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
Class Series
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class Series < ApplicationRecord
include Bookmarkable
include Searchable
include Creatable
Method setup_for_review
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def setup_for_review
set_limit
@nom_limit = 30
@nominations = HashWithIndifferentAccess.new
@nominations_count = HashWithIndifferentAccess.new
- 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 _create
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
_create: function() {
this.element.closest( "form" )
.unbind( "reset" + this.eventNamespace )
.bind( "reset" + this.eventNamespace, formResetHandler );
Method sort_link
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def sort_link(title, column=nil, options = {})
condition = options[:unless] if options.has_key?(:unless)
unless column.nil?
current_column = (params[:sort_column] == column.to_s) || params[:sort_column].blank? && options[:sort_default]
- 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 wrangle
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def wrangle
params[:page] = '1' if params[:page].blank?
params[:sort_column] = 'name' if !valid_sort_column(params[:sort_column], 'tag')
params[:sort_direction] = 'ASC' if !valid_sort_direction(params[:sort_direction])
options = {show: params[:show], page: params[:page], sort_column: params[:sort_column], sort_direction: params[:sort_direction]}
- 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 Callbacks
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
File comment.rb
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Comment < ApplicationRecord
include HtmlCleaner
include AfterCommitEverywhere
belongs_to :pseud
Consider simplifying this complex logical expression. Open
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
Method update
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def update
new_collections = []
unapproved_collections = []
errors = []
bookmark_params[:collection_names]&.split(",")&.map(&:strip)&.uniq&.each do |collection_name|
- 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 33 (exceeds 5 allowed). Consider refactoring. Open
def show
@tag_groups = @work.tag_groups
if params[:view_adult]
cookies[:view_adult] = "true"
elsif @work.adult? && !see_adult?
- 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 delayed_generate
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def self.delayed_generate(collection_id)
collection = Collection.find(collection_id)
if collection.challenge.assignments_sent_at.present?
# If assignments have been sent, we don't want to delete everything and
- 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 32 (exceeds 5 allowed). Consider refactoring. Open
def show
# don't bother collecting tags unless the user gets to see them
if @tag_set.visible || @tag_set.user_is_moderator?(current_user)
# we use this to collect up fandom parents for characters and relationships
- 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 clean_css_code
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def clean_css_code(css_code, options = {})
return "" if !css_code.match(/\w/) # only spaces of various kinds
clean_css = ""
parser = CssParser::Parser.new
parser.add_block!(css_code)
- 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
File challenge_assignment.rb
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ChallengeAssignment < ApplicationRecord
# We use "-1" to represent all the requested items matching
ALL = -1
belongs_to :collection
File application_controller.rb
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
include Pundit::Authorization
protect_from_forgery with: :exception, prepend: true
rescue_from ActionController::InvalidAuthenticityToken, with: :display_auth_error
Function support
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
jQuery.support = (function() {
var support, all, a, select, opt, input, fragment, eventName, isSupported, i,
div = document.createElement("div");
Method load_site_css
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def self.load_site_css
Skin.skin_dir_entries(Skin.site_skins_dir, /^\d+\.\d+$/).each do |version|
version_dir = "#{Skin.site_skins_dir + version}/"
if File.directory?(version_dir)
# let's load up the file
- 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"