Showing 1,031 of 1,643 total issues
Method send_notification
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_notification(action)
if sends_email?
begin
if self.requestor && !self.requestor.notification_emails.empty?
notify(:generic_message, "task_#{action}", 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"
Further reading
Method visible_to_user?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def visible_to_user?(user)
visible = self.display_to_user?(user)
if self.owner.kind_of?(Profile)
visible &= self.owner.display_to?(user)
visible &= (self.visible? || user && user.has_permission?(:edit_profile_design, self.owner))
- 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 process_all_comments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_all_comments
self.class.log("Starting to process all comments")
comments = comments_to_process
total = comments.count
pbar = ProgressBar.create(title: "☢ Comments", total: total, format: "%t: |%B| %E") if Rails.env.development?
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def perform
logpath = File.join(Rails.root, "log", "#{ENV['RAILS_ENV']}_memory_consumption.log")
logger = Logger.new(logpath)
stats = Hash.new(0)
ObjectSpace.each_object { |o| stats[o.class.to_s] += 1 }
- 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 new
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def new
@no_design_blocks = true
@category = params[:selected_category_id] ? Category.find(params[:selected_category_id]) : nil
@product = @profile.products.build(product_category: @category)
@categories = ProductCategory.top_level_for(environment)
- 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 send_notifications
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_notifications
if source.kind_of?(Article) && article.notify_comments?
if !notification_emails.empty?
notify(:new_comment_for_author, self)
end
- 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_stream_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_stream_info(stream_str)
stream_info = { type: "undefined" }
stream_info[:type] = "video" if / Video:/.match(stream_str)
stream_info[:type] = "audio" if / Audio:/.match(stream_str)
{
- 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 validator_correct_region
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validator_correct_region
if self.region && self.target
unless self.region.validators.include?(self.target) || self.target_type == "Environment"
self.errors.add(:target, _("{fn} is not a validator for the chosen region").fix_i18n)
end
- 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 application_controller_filters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def application_controller_filters
block = proc do
begin
remote_user = request.headers["HTTP_REMOTE_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
Method theme_opt_menu_search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def theme_opt_menu_search
opt = theme_option(:menu_search)
if opt == "none"
""
elsif opt == "simple_search"
- 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_registered_friend
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def invite_registered_friend
contacts_to_invite = params["q"].split(",")
if !contacts_to_invite.empty? && request.post?
Delayed::Job.enqueue InvitationJob.new(user.id, contacts_to_invite, "", profile.id, nil, locale)
session[:notice] = _("Your invitations are being sent.")
- 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 display_short_format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def display_short_format(article, options = {})
options[:comments_link] ||= true
options[:read_more_link] ||= true
lead_links = (options[:comments_link] ? link_to_comments(article) : "") + (options[:read_more_link] ? reference_to_article(_("Read more"), article) : "")
html = content_tag("div",
- 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 task_information
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def task_information(task, params = {})
values = {}
values.merge!(task.information[:variables]) if task.information[:variables]
values.merge!(requestor: link_to(task.requestor.name, task.requestor.url)) if task.requestor
if (task.target && task.target.respond_to?(:url))
- 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 city_with_state
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def city_with_state(city)
if city && city.kind_of?(City)
s = city.parent
if s && s.kind_of?(State) && s.acronym
city.name + ", " + s.acronym
- 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 prepare_external_feed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare_external_feed
unless self.external_feed_data.nil?
if self.external_feed && self.external_feed.id == self.external_feed_data[:id].to_i
self.external_feed.attributes = self.external_feed_data.except(: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 unfollow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unfollow
follower = params[:follower_id].present? ? Person.find_by(id: params[:follower_id]) : current_person
if follower && follower.follows?(profile)
follower.unfollow(profile)
- 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 copy_article_tree
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_article_tree(article, parent = nil)
return if !copy_article?(article)
original_article = self.articles.find_by name: article.name
if original_article
- 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 profile_image
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def profile_image(profile, size = :portrait, opt = {})
return "" if profile.nil?
opt[:alt] ||= profile.name()
opt[:title] ||= ""
- 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 list_contents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def list_contents(configure = {})
configure[:recursive] ||= false
configure[:list_type] ||= :folder
contents = configure[:contents]
contents = contents.order("name ASC") unless contents.is_a? Array
- 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 modal_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def modal_options(options, type = nil)
inline_selector = options.delete :inline
options[:onclick] = "return noosfero.modal.inline('#{inline_selector}')" if inline_selector
classes = if inline_selector || (type == :close) then "" else "open-modal" end
- 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"