Showing 1,643 of 1,643 total issues
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 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"
Further reading
Method insert_boxes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def insert_boxes(content)
if controller.send(:boxes_editor?) && controller.send(:uses_design_blocks?)
content + display_boxes_editor(controller.boxes_holder)
else
maybe_display_custom_element(controller.boxes_holder, :custom_header_expanded, id: "profile-header") +
- 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 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 activate_enterprise
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def activate_enterprise
@terms_of_use = environment.terms_of_use
@enterprise = load_enterprise
@question = @enterprise.question
return unless check_answer
- 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 destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def destroy
if request.post?
organization = environment.organizations.find(params[:id])
if organization && organization.destroy
render plain: (_("%s removed") % organization.name).to_json
- 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 available_plugins
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def available_plugins
unless @available_plugins
path = File.join(Rails.root, "{baseplugins,config/plugins}", "*")
@available_plugins = Dir.glob(path).select { |i| File.directory?(i) }
if (Rails.env.test? || Rails.env.cucumber?) && !@available_plugins.include?(File.join(Rails.root, "config", "plugins", "foo"))
- 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 save_associations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save_associations
error = false
roles = Profile::Roles.organization_member_roles(environment.id)
roles.select { |role| params["q_" + role.key] }.each do |role|
people = [Person.find(params["q_" + role.key].split(","))].flatten
- 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_activity
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_activity
target = if self.target.is_a? Profile then self.target else self.target.profile rescue self.user end
return if !target
return if self.verb.in? target.exclude_verbs_on_activities
- 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 update_profile_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_profile_data
@profile_data = profile
if request.post?
begin
@profile_data.update!(params[:profile_data])
- 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 post_task
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def post_task(asset, params)
klass_type = params[:content_type].nil? ? "Task" : params[:content_type]
return forbidden! unless klass_type.constantize <= Task
return forbidden! if !current_person.has_permission?(:perform_task, asset)
- 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 start_thread
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def start_thread
@mutex.synchronize do
return if @thread && @thread.alive?
@thread = Thread.new do
- 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 sensitive_content
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sensitive_content
current_page = params[:page] ? Article.find(params[:page]) : nil
select_subdirectory = !params[:select_subdirectory].nil?
@sensitive_back = params[:not_back] ? (params[:not_back] == "true") : 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 fetch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fetch(address, header = {})
begin
content = ""
block = lambda { |s| content = s.read }
content =
- 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 set_portal_folders
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_portal_folders
@selected = (environment.portal_folders || [])
@available_portal_folders = environment.portal_community.folders - @selected
if request.post?
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def index
asset = params[:asset].in?(type_filters.values) ? params[:asset]
: :profiles
order = params[:order_by].in?(order_filters.values) ? params[:order_by]
: 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 article_list_to_json
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def article_list_to_json(list)
list.map do |item|
{
"title" => item.title,
"url" => item.image? ? item.public_filename(:uploaded) : url_for(item.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 period
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def period(from_date, until_date)
return nil if from_date.nil? && until_date.nil?
begin_period = from_date.nil? ? Time.at(0).to_datetime : from_date
end_period = until_date.nil? ? DateTime.now : until_date
- 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 NOOSFERO_CONF
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.NOOSFERO_CONF
if @@NOOSFERO_CONF
@@NOOSFERO_CONF
else
file = Rails.root.join("config", "noosfero.yml")
- 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"