Skip to content

Code quality

ALN** occurrences by order of importance

NOQA Number of occurrences
ALN069: You can't import models from other components, see: https://www.notion.so/alaninsurance/Modular-monolith-a9d84f1318d34115bbd08b3648e5a587 ⧉", 37
ALN043: You can only import things from a Component public module, see: https://www.notion.so/alaninsurance/Modular-monolith-a9d84f1318d34115bbd08b3648e5a587 ⧉", 28
ALN039: The module public cannot import other components (or from apps/), it's meant to be the public interface of the component #{self.component_name}, see: https://www.notion.so/alaninsurance/Modular-monolith-a9d84f1318d34115bbd08b3648e5a587 ⧉", 4
ALN002: Checks that we don't import components in shared 1
ALN027: This class checks that no protected attribute access is used. 10
ALN083: Flake8 plugin to check ProfileService constructor usage. 1
ALN085: Enforces SQLAlchemy 2.0 query style by detecting deprecated patterns that will be removed in SQLAlchemy 2.0. This linter checks for: 1. Usage of session.query() which is deprecated in favor of session.scalar(), session.scalars(), or session.execute() Note: Other SQLAlchemy 2.0 deprecation warnings are already being turned into errors at runtime by the _turn_sql_alchemy_warning_into_errors function in backend/shared/models/orm/sqlalchemy.py. 28

Listing of files of the most critical ALN**

ALN069 occurs 37 times

File:line Content
components/global_profile/public/tests/init_profile_for_users.py:11 ⧉ from components.be.internal.models.be_address import ( # noqa: ALN039, ALN069
components/global_profile/public/tests/init_profile_for_users.py:14 ⧉ from components.es.internal.models.es_address import ( # noqa: ALN039, ALN069
components/global_profile/public/tests/init_profile_for_users.py:17 ⧉ from components.fr.internal.models.address import ( # noqa: ALN039, ALN069
components/global_profile/internal/application/tests/test_global_user_compatibility.py:6 ⧉ from components.be.internal.models.tests.factories import ( # noqa: ALN069
components/global_profile/internal/application/tests/test_global_user_compatibility.py:12 ⧉ from components.es.internal.models.tests.factories import ( # noqa: ALN069
components/global_profile/internal/infrastructure/tests/test_global_user_repository.py:6 ⧉ from components.be.internal.models.tests.factories import ( # noqa: ALN069
components/global_profile/internal/infrastructure/tests/test_global_user_repository.py:13 ⧉ from components.es.internal.models.tests.factories import ( # noqa: ALN069
components/global_profile/internal/commands/normalize_phone_numbers.py:113 ⧉ from components.fr.internal.models.user import User # noqa: ALN069
components/global_profile/internal/commands/normalize_phone_numbers.py:117 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN069
components/global_profile/internal/commands/normalize_phone_numbers.py:121 ⧉ from components.es.internal.models.es_user import EsUser # noqa: ALN069
components/global_profile/internal/commands/normalize_phone_numbers.py:125 ⧉ from components.ca.internal.tech.models.ca_user import ( # noqa: ALN069
components/global_profile/internal/commands/backfill_es_profile.py:9 ⧉ from components.es.internal.models.es_user import ( # noqa: ALN069 # : for migration only
components/global_profile/internal/commands/clean_data.py:12 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:13 ⧉ from components.ca.internal.tech.models.ca_user import ( # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:16 ⧉ from components.es.internal.models.es_user import EsUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:17 ⧉ from components.fr.internal.models.user import User # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:44 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:45 ⧉ from components.ca.internal.tech.models.ca_user import ( # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:48 ⧉ from components.es.internal.models.es_user import EsUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:49 ⧉ from components.fr.internal.models.user import User # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:79 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:80 ⧉ from components.es.internal.models.es_user import EsUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:81 ⧉ from components.fr.internal.models.user import User # noqa: ALN043, ALN069
components/global_profile/internal/commands/backfill_be_profile.py:9 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN069
components/global_profile/internal/commands/backfill_user_phone_numbers.py:42 ⧉ from components.fr.internal.models.user import User # noqa: ALN069
components/global_profile/internal/commands/backfill_user_phone_numbers.py:46 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN069
components/global_profile/internal/commands/backfill_user_phone_numbers.py:50 ⧉ from components.es.internal.models.es_user import EsUser # noqa: ALN069
components/global_profile/internal/commands/backfill_user_phone_numbers.py:54 ⧉ from components.ca.internal.tech.models.ca_user import ( # noqa: ALN069
components/global_profile/internal/commands/fix_name.py:104 ⧉ from components.be.internal.models.be_user import ( # noqa: ALN069
components/global_profile/internal/commands/fix_name.py:110 ⧉ from components.ca.internal.tech.models.ca_user import ( # noqa: ALN069
components/global_profile/internal/commands/fix_name.py:116 ⧉ from components.es.internal.models.es_user import ( # noqa: ALN069
components/global_profile/internal/commands/fix_name.py:122 ⧉ from components.fr.internal.models.user import User # noqa: ALN069
components/global_profile/internal/commands/bad_names_stats.py:63 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN069
components/global_profile/internal/commands/bad_names_stats.py:67 ⧉ from components.ca.internal.tech.models.ca_user import ( # noqa: ALN069
components/global_profile/internal/commands/bad_names_stats.py:76 ⧉ from components.es.internal.models.es_user import EsUser # noqa: ALN069
components/global_profile/internal/commands/bad_names_stats.py:80 ⧉ from components.fr.internal.models.user import User # noqa: ALN069
components/global_profile/internal/commands/backfill_fr_profile.py:9 ⧉ from components.fr.internal.models.user import User as FrUser # noqa: ALN069

ALN043 occurs 28 times

File:line Content
components/global_profile/public/api.py:156 ⧉ from components.ca.internal.user.profile.repository import ( # noqa:ALN039, ALN043
components/global_profile/public/tests/test_user_repository.py:12 ⧉ from components.global_profile.internal.domain.entities import ( # noqa: ALN043
components/global_profile/public/tests/test_user_repository.py:16 ⧉ from components.global_profile.internal.domain.events import DomainEvent # noqa: ALN043
components/global_profile/public/tests/test_user_repository.py:17 ⧉ from components.global_profile.internal.domain.repository import ( # noqa: ALN043
components/global_profile/public/tests/test_user_repository.py:20 ⧉ from components.global_profile.internal.infrastructure.repository import ( # noqa: ALN043
components/global_profile/public/tests/mock_profile_service.py:37 ⧉ from components.global_profile.internal.infrastructure.unit_of_work import ( # noqa: ALN043
components/global_profile/internal/application/tests/test_global_user_compatibility.py:9 ⧉ from components.ca.internal.tests.factories.factories import ( # noqa: ALN043
components/global_profile/internal/application/tests/test_global_user_compatibility.py:15 ⧉ from components.fr.internal.tests.factories.user import UserFactory # noqa: ALN043
components/global_profile/internal/infrastructure/global_user_repository.py:8 ⧉ from components.be.internal.global_profile.repository import ( # noqa: ALN043
components/global_profile/internal/infrastructure/global_user_repository.py:11 ⧉ from components.es.internal.business_logic.profile.repository import ( # noqa: ALN043
components/global_profile/internal/infrastructure/global_user_repository.py:14 ⧉ from components.fr.internal.business_logic.profile.repository import ( # noqa: ALN043
components/global_profile/internal/infrastructure/tests/test_global_user_repository.py:10 ⧉ from components.ca.internal.tests.factories.factories import ( # noqa: ALN043
components/global_profile/internal/infrastructure/tests/test_global_user_repository.py:17 ⧉ from components.fr.internal.tests.factories.user import ( # noqa: ALN043
components/global_profile/internal/commands/backfill_es_profile.py:6 ⧉ from components.es.internal.business_logic.profile.repository import ( # noqa: ALN043 # : for migration only
components/global_profile/internal/commands/clean_data.py:12 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:13 ⧉ from components.ca.internal.tech.models.ca_user import ( # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:16 ⧉ from components.es.internal.models.es_user import EsUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:17 ⧉ from components.fr.internal.models.user import User # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:44 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:45 ⧉ from components.ca.internal.tech.models.ca_user import ( # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:48 ⧉ from components.es.internal.models.es_user import EsUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:49 ⧉ from components.fr.internal.models.user import User # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:79 ⧉ from components.be.internal.models.be_user import BeUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:80 ⧉ from components.es.internal.models.es_user import EsUser # noqa: ALN043, ALN069
components/global_profile/internal/commands/clean_data.py:81 ⧉ from components.fr.internal.models.user import User # noqa: ALN043, ALN069
components/global_profile/internal/commands/backfill_be_profile.py:6 ⧉ from components.be.internal.global_profile.repository import ( # noqa: ALN043
components/global_profile/internal/commands/backfill_fr_profile.py:6 ⧉ from components.fr.internal.business_logic.profile.repository import ( # noqa: ALN043
components/global_profile/internal/controllers/tests/test_profile.py:3 ⧉ from components.fr.internal.tests.factories.user import ( # noqa: ALN043 # It's a test, we will change its use after

ALN039 occurs 4 times

File:line Content
components/global_profile/public/api.py:156 ⧉ from components.ca.internal.user.profile.repository import ( # noqa:ALN039, ALN043
components/global_profile/public/tests/init_profile_for_users.py:11 ⧉ from components.be.internal.models.be_address import ( # noqa: ALN039, ALN069
components/global_profile/public/tests/init_profile_for_users.py:14 ⧉ from components.es.internal.models.es_address import ( # noqa: ALN039, ALN069
components/global_profile/public/tests/init_profile_for_users.py:17 ⧉ from components.fr.internal.models.address import ( # noqa: ALN039, ALN069