Showing 1,031 of 1,643 total issues
Method invite_event_to
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def invite_event_to(article)
profiles = profile.kind_of?(Organization) ? profile.members : profile.friends
inviteds = article.invitations if article.event?
result = []
profiles.each do |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 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 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 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 allow_cross_domain_access
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def allow_cross_domain_access
origin = request.headers["Origin"]
return if origin.blank?
if environment.access_control_allow_origin.include? origin
- 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 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 find_activities
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_activities(asset, method_or_relation = "tracked_notifications")
not_found! if asset.blank? || asset.secret || !asset.visible
forbidden! unless asset.display_private_info_to?(current_person)
if method_or_relation == "activities"
activities = select_filtered_collection_of(asset, method_or_relation, params)
- 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"
Further reading
Method load_recent_files
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_recent_files(parent_id = nil, q = nil, paginate_options = { page: 1, per_page: 6 })
# TODO Since we only have special support for images, I'm limiting myself to
# consider generic files as non-images. In the future, with more supported
# file types we'll need to have a smart way to fetch from the database
# scopes of each supported type as well as the non-supported types as a
- 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"