Showing 213 of 251 total issues
Method to_csv
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_csv
CSV.generate(csv_options) do |csv|
csv << headers
data.each do |row|
csv << columns.collect do |column_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 fill_in_template_profile_information
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fill_in_template_profile_information
self.profile_fields.create(label: :personal_title, type: "ProfileFields::General")
self.profile_fields.create(label: :academic_degree, type: "ProfileFields::AcademicDegree")
self.profile_fields.create(label: :work_address, type: "ProfileFields::Address")
- 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 link_to_add_profile_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def link_to_add_profile_field( args )
raise ActionController::ParameterMissing, "expected argument 'profileable'" unless args[:profileable].present?
raise ActionController::ParameterMissing, "expected argument 'profile_field_type'" unless args[:profile_field_type].present?
raise ActionController::ParameterMissing, "expected argument 'profile_section'" unless args[:profile_section].present?
label_in_english_with_underscores = args[:profile_field_type].demodulize.underscore
- 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 reference
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reference
ref = super
if ref.kind_of? DagLink
if ref.ancestor_type == "Group" and ref.descendant_type == "User"
ref.becomes(Membership)
- 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 allowed_preview_roles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def allowed_preview_roles
return ['global_admin', 'admin', 'officer', 'global_officer', 'user', 'public'] if global_admin?
return ['admin', 'officer', 'user', 'public'] if admin?
return ['officer', 'global_officer', 'user', 'public'] if global_officer? and officer?
return ['officer', 'user', 'public'] if officer?
- 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 ancestors_cache_key
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ancestors_cache_key
"Group#{ancestor_group_ids if respond_to?(:ancestor_group_ids)}Page#{ancestor_page_ids if respond_to?(:ancestor_page_ids)}User#{ancestor_user_ids if respond_to?(:ancestor_user_ids)}"
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 destroy_dag_links
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def destroy_dag_links
# destory only child and parent links, since the indirect links
# are destroyed automatically by the DagLink model then.
links = self.links_as_parent + self.links_as_child
- 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 current_ability_as_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def current_ability_as_user(reload = false, options = {})
#if reload
# @current_ability = nil
# @current_role = nil
# @current_role_view = 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 index
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def index
authorize! :index, TermReport
if term && corporation
redirect_to term_report_path(id: TermReports::ForCorporation.by_corporation_and_term(corporation, term))
- 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
if corporations_by_token.any?
if corporations_by_token.count == 1
redirect_to corporations_by_token.first
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 show
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show
authorize! :read, group
authorize! :export_member_list, group
list_preset_i18n = I18n.translate(list_preset) if list_preset.present?
- 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 log_activity
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def log_activity
if not read_only_mode? and not action_name.in?(["new", "index", "show", "download", "autocomplete_title", "preview", "description"]) and not params['controller'].in?(['sessions', 'devise/sessions', 'api/v1/sessions', 'profile_fields', 'user_accounts'])
begin
type = self.class.name.gsub("Controller", "").singularize
id = params[:id]
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
@user = user
authorize! :update, @user
if not user_params[:incognito].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"