Showing 213 of 251 total issues
Method delete_from_graph_database
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def delete_from_graph_database
if self.reload.direct?
Graph::HasSubgroup.find(self).delete if ancestor.kind_of?(Group) && descendant.kind_of?(Group)
Graph::Membership.find(self).delete if ancestor.kind_of?(Group) && descendant.kind_of?(User)
Graph::HasSubpage.find(self).delete if ancestor.kind_of?(Page) && descendant.kind_of?(Page)
- 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 renew_cache
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def renew_cache(record, options)
with_timeout do
if record
if options[:method].present?
Rails.cache.renew(options[:time]) { record.send(options[:method]) if record.respond_to?(options[:method]) }
- 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 NavNode
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class NavNode < ApplicationRecord
belongs_to :navable, polymorphic: true
include RailsSettings::Extend
Consider simplifying this complex logical expression. Open
if not read_only_mode?
# Local officers can create events in their groups.
#
can :create, Event
can [:create_event, :create_event_for], Group do |group|
Consider simplifying this complex logical expression. Open
if not read_only_mode?
# Jeder muss Dokumente erstellen können, z.B. um Konventsprotokolle hochzuladen.
# Ansonsten würden auch Verteilermails mit Dokumenten fehlschlagen.
can :create, Document
Method show
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def show
set_current_title group.title
set_current_navable group
set_current_tab :contacts
- 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 rights_for_local_officers
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rights_for_local_officers
can :export_member_list, Group do |group|
user.in? group.officers_of_self_and_ancestors
end
Class Membership
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Membership < DagLink
alias_attribute :user_id, :descendant_id
alias_attribute :user, :descendant
alias_attribute :group_id, :ancestor_id
Class Ability
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Ability
include CanCan::Ability
def ability_classes
[
Method store_as_posts_when_authorized
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def store_as_posts_when_authorized
recipient_emails.collect do |recipient_email|
if group = ProfileFields::MailingListEmail.where(value: recipient_email).first.try(:profileable)
if no_duplicates_exist?(group) || Rails.env.development?
ability = Ability.new(self.sender_user)
Method search_by_profile_fields
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def search_by_profile_fields(query)
profile_fields = ProfileField.where_like(value: query).or(
ProfileField.where_like(label: query)
)
profile_fields.includes(:parent).to_a.collect do |profile_field|
- 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_default_mailing_lists
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.create_default_mailing_lists
Corporation.active.all.each do |corporation|
if corporation.subdomain.present?
domain = "#{corporation.subdomain}.#{AppVersion.domain}"
["Aktivitas", "Burschen", "Fuxen", "Senior (x)", "Fuxmajor (xx)", "Kneipwart (xxx)", "Chargen", "Hauptkassenwart", "Gäste", "Hausbewohner", "Philisterschaft", "Altherrenschaft"].each do |group_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 rights_for_everyone
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rights_for_everyone
# Feature switches
#
can :use, :semester_calendars
Method add_flags
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def add_flags(*new_flags)
if new_flags.kind_of? Array
for new_flag in new_flags
if new_flag.kind_of? String or new_flag.kind_of? Symbol
if not self.has_flag? new_flag
- 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 render_unauthorized
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def render_unauthorized(exception)
Rails.logger.info "Access denied for user #{current_user.try(:id)} on #{exception.action} for #{session['exception.subject']}."
if request.format.html? || controller_name == "attachment_downloads"
if exception.action || exception.subject
if exception.subject.kind_of? String or exception.subject.kind_of? Symbol
- 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 cache_method
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def cache_method(method_name)
if use_caching?
# If a setter method exists as well, make the setter method
# also renew the cache.
- 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 parse
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(payload, sso_secret = nil)
sso = new
sso.sso_secret = sso_secret if sso_secret
parsed = Rack::Utils.parse_query(payload)
if sso.sign(parsed["sso"]) != parsed["sig"]
- 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 fill_cache
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def fill_cache
super
if kind_of?(OfficerGroup) && scope
scope.fill_cache_concerning_roles_for(self.class.structureable_role_methods_to_cache) if scope.respond_to?(:fill_cache_concerning_roles_for)
- 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 hash_array_import_groups_into_parent_group
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def hash_array_import_groups_into_parent_group( hash_array_of_groups, parent_group )
return unless hash_array_of_groups
counter_for_created_groups = 0
for new_group_hash in hash_array_of_groups 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 create
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create
authorize! :create_accommodation_sepa_debit, corporation
institution.settings.creditor_identifier = creditor_identifier
- 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"