core/domain/email_manager_test.py
File email_manager_test.py
has 6121 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
NotifyContributionDashboardReviewersEmailTests
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class NotifyContributionDashboardReviewersEmailTests(test_utils.EmailTestBase):
"""Tests the send_mail_to_notify_contributor_dashboard_reviewers method,
which sends an email to reviewers with information regarding the suggestions
that have waited the longest for review.
"""
Function test_email_sent_to_admins_if_mutli_suggestion_types_needing_reviewers
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_email_sent_to_admins_if_mutli_suggestion_types_needing_reviewers(
self
) -> None:
self._create_translation_suggestion_with_language_code('fr')
self._create_translation_suggestion_with_language_code('hi')
Function test_can_users_receive_thread_email
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_can_users_receive_thread_email(self) -> None:
gae_ids = ('someUser1', 'someUser2')
exp_id = 'someExploration'
usernames = ('username1', 'username2')
emails = ('user1@example.com', 'user2@example.com')
Function test_sender_id_validation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def test_sender_id_validation(self) -> None:
sender_ids_to_test = [
feconf.SYSTEM_COMMITTER_ID, self.admin_id, self.moderator_id,
self.editor_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"