Showing 17 of 1,768 total issues
Method import!
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
def import!
errors = []
ActiveRecord::Base.transaction do
i = 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 import!
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import!
errors = []
ActiveRecord::Base.transaction do
i = 1
Method valid_activities
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def valid_activities
return @valid_activities if defined?(@valid_activities)
valid_activities_count = 0
@valid_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 export
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export
results = Decidim::Accountability::Result
.where(component: @component)
.includes(:category, :resource_links_from, :resource_links_to)
.order(:id)
Method informable_ephemeral_participant?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def informable_ephemeral_participant?
return false if verify_ephemeral_participant_path?
return false if edit_ephemeral_participant_path?
return false if update_ephemeral_participant_path?
return false if unverifiable_ephemeral_participant_path?
- 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 initiative_admin_user_action?
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initiative_admin_user_action?
return unless permission_action.subject == :initiative
case permission_action.action
when :read
Method validate_ephemeral_participation_permissions_settings
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_ephemeral_participation_permissions_settings
return if resource_permissions?
return unless ephemeral_participation_enabled?
permissions.values.each do |permission_form|
- 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 user_ids
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def user_ids
Decidim::Authorization
.where(name: "census_sms_authorization_handler").find_each.map do |authorization|
date_of_birth = begin
Date.parse(authorization.metadata["date_of_birth"])
- 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_managed_user
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_managed_user
if [new_user, managed_user].any?(&:ephemeral_participant?)
Decidim::EphemeralParticipation::TransferEphemeralParticipant.call(form).tap do |events|
raise(ActiveRecord::Rollback) if events.has_key?(:invalid)
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 call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def call
return broadcast(:invalid) unless valid_params?
if transfer_ephemeral_participant?
set_last_location
- 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
Avoid too many return
statements within this method. Open
return false if request.flash.any?
Method verify_ephemeral_participant_path?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify_ephemeral_participant_path?
return false if homepage?
adapter = ephemeral_participation_verification_adapter
engine = adapter.type == "direct" ? Decidim::Verifications::Engine : adapter.send(:main_engine)
- 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 redirect_ephemeral_participant
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def redirect_ephemeral_participant
return redirect_to(unverifiable_ephemeral_participant_path(current_user)) if redirect_to_unverifiable_ephemeral_participant_path?
return redirect_to(ephemeral_participation_path) if redirect_to_ephemeral_participation_path?
return redirect_to(edit_ephemeral_participant_path(current_user)) if redirect_to_edit_ephemeral_participant_path?
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 base_error_messages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def base_error_messages(record)
return unless record.respond_to?(:errors)
return unless record.errors[:base].any?
alert_box(record.errors.full_messages_for(:base).join(",").html_safe, "alert", 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 any_zero_duration_event?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def any_zero_duration_event?(agendas, meeting)
agenda_items_times = calculate_start_and_end_time_of_agenda_items(agendas, meeting)
agenda_items_times.any? { |agenda_time| (agenda_time[:start_time] - agenda_time[:end_time]).zero? } ||
agendas.map.with_index do |agenda, index|
next unless agenda.agenda_item_children.presence
- 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
raise ActionController::RoutingError, "Not Found" unless meeting
return if meeting.visible_for_admin_user?(current_user) || meeting.current_user_can_visit_meeting?(current_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 call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def call
return broadcast(:invalid) unless form.valid?
transaction do
update_managed_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"