Showing 216 of 688 total issues
Avoid deeply nested control flow statements. Open
if oidreq.immediate
oidresp = oidreq.answer(false)
elsif session[:username]
# The user hasn't logged in.
# show_decision_page(oidreq) # this doesnt make sense... it was in the example though
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
unless params[:hash_params].to_s.empty?
hash_params = URI.parse("#" + params[:hash_params]).to_s
end
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if current_user.crypted_password.nil? # the user has not created a pwd in the new site
flash[:warning] = I18n.t('user_sessions_controller.create_password_for_new_site')
redirect_to '/profile/edit'
else
flash[:notice] = I18n.t('user_sessions_controller.logged_in')
- Create a ticketCreate a ticket
Function notyNotification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function notyNotification(theme, timeout, type, layout, text){
- Create a ticketCreate a ticket
Method map_data_string
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.map_data_string(lat, lon, tagname, template, mainLayer = nil)
- Create a ticketCreate a ticket
Method content_followed_in_period
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def content_followed_in_period(start_time, end_time,
order_by = 'node_revisions.timestamp DESC', node_type = 'note', include_revisions = false)
- Create a ticketCreate a ticket
Method notify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def notify(current_user)
if status == 4
AdminMailer.notify_comment_moderators(self).deliver_later!(wait_until: 24.hours.from_now)
else
if parent.uid != current_user.uid && !UserTag.exists?(parent.uid, 'notify-comment-direct:false')
- 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 reset_user_password
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def reset_user_password
if logged_in_as(['admin'])
user = User.find(params[:id])
if user
key = user.generate_reset_key
- 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 revision
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def revision
@node = Node.find_wiki(params[:id])
if @node
@tags = @node.tags
@tagnames = @tags.collect(&:name)
- 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 wiki
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def wiki
@node = Node.find_wiki(params[:id])
if @node.blank? || @node.has_power_tag("lat").blank? || @node.has_power_tag("lon").blank?
flash[:warning] = @node.blank? ? "Wiki page not found." : "No location found for wiki page."
- 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 path
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def path(size = :default)
if is_image?
if size == :thumb
"/#{filepath.gsub('sites/default/files/', 'sites/default/files/imagecache/thumb/')}"
elsif size == :default
- 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 subscribers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.subscribers(tags)
tids = tags.collect(&:tid)
# include special tid for indiscriminant subscribers who want it all!
all_tag = Tag.find_by(name: 'everything')
tids += [all_tag.tid] if all_tag
- 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 new_comment_from_email
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.new_comment_from_email(mail)
user = User.where(email: mail.from.first).first
if user
node_id = mail.subject[/#([\d]+)/, 1] # This tooks out the node ID from the subject line
comment_id = mail.subject[/#c([\d]+)/, 1] # This tooks out the comment ID from the subject line if it exists
- 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
Function makeDeepCopy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const makeDeepCopy = (input) => {
let output, value, key;
if (typeof input !== "object" || input === null || React.isValidElement) {
return input;
- 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 order_string
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def order_string
if params[:search] || @toggle == "uses"
params[:order].blank? || (params[:order] == "desc") ? "count DESC" : "count ASC"
else
params[:order].blank? || (params[:order] == "desc") ? "name DESC" : "name ASC"
- 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 change_locale
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def change_locale
lang = params[:locale].to_s.strip.to_sym
lang = I18n.default_locale unless I18n.available_locales.include?(lang)
cookies.permanent[:plots2_locale] = lang
I18n.locale = lang
- 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 migrate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def migrate
if logged_in_as(['admin'])
du = User.find params[:id]
if du.user
flash[:error] = 'The user has already been migrated.'
- 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 index
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def index
range
if @start > @end
flash.now[:warning] = "Start date must come before end date"
end
- 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 react_delete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def react_delete
@comment = Comment.find params[:id]
comments_node_and_path
- 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 activity
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def activity
blog = Tag.find_nodes_by_type('blog', 'note', 1).first
# remove "classroom" postings; also switch to an EXCEPT operator in sql, see https://github.com/publiclab/plots2/issues/375
hidden_nids = Node.hidden_response_node_ids
notes = Node.where(type: 'note')
- 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"