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 ⧉", 15
ALN043: You can only import things from a Component public module, see: https://www.notion.so/alaninsurance/Modular-monolith-a9d84f1318d34115bbd08b3648e5a587 ⧉", 9
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 ⧉", 2
ALN037: @property are not serialized by dataclass_json. If not a problem for your use case, please ignore (# noqa: ALN037). "See this Notion page: https://www.notion.so/alaninsurance/Dataclass-the-good-parts-8f387ec2a8e24a55af294237b97dc210#a611a9154af448a38e552c61415169df ⧉ 1
ALN059: Checks that all component dependencies are declared in the root of a component 1
ALN077: Check for usage of backref in SQLAlchemy relationships and suggest using back_populates instead. 12
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. 90
ALN089: pytest fixtures with autouse=True in conftest.py files can have unwanted side-effects as they will be used in any tests in the subfolders and can inadvertently use other fixtures that add functionality. Instead, mark tests that need the fixture explicitly with @pytest.mark.usefixtures("fixture_name") or use the fixture as a parameter. 1

Listing of files of the most critical ALN**

ALN069 occurs 15 times

File:line Content
components/occupational_health/conftest.py:93 ⧉ from components.contracting.subcomponents.subscription.internal.models.subscription import ( # noqa: ALN069 - yes this is ugly
components/occupational_health/conftest.py:96 ⧉ from components.contracting.subcomponents.subscription.internal.models.subscription_update import ( # noqa: ALN069 - yes this is ugly
components/occupational_health/conftest.py:99 ⧉ from components.contracting.subcomponents.subscription.internal.models.subscription_version import ( # noqa: ALN069 - yes this is ugly
components/occupational_health/internal/queries/invoices.py:50 ⧉ from components.fr.internal.billing.models.invoice import Invoice # noqa: ALN069
components/occupational_health/internal/queries/invoices.py:107 ⧉ from components.fr.internal.billing.models.invoice import Invoice # noqa: ALN069
components/occupational_health/internal/commands/analyze_employment_sources.py:58 ⧉ # worth it: we ignore ALN069
components/occupational_health/internal/commands/analyze_employment_sources.py:59 ⧉ from components.employment.internal.models.core_employment_version import ( # noqa: ALN069
components/occupational_health/internal/commands/analyze_employment_sources.py:64 ⧉ from components.fr.internal.models.bulk_invite.employee_bulk_import_file import ( # noqa: ALN069
components/occupational_health/internal/commands/analyze_employment_sources.py:157 ⧉ from components.employment.internal.models.employment_source_data import ( # noqa: ALN069
components/occupational_health/internal/commands/turing/compute_next_visit_by_occupational_health_profile.py:6 ⧉ from components.affiliation_occ_health.internal.models.occupational_health_affiliation import ( # noqa: ALN069
components/occupational_health/internal/profile/actions/tests/test_update_occupational_health_profile_merge.py:6 ⧉ from components.affiliation_occ_health.internal.models.occupational_health_affiliation import ( # noqa: ALN069
components/occupational_health/internal/business_logic/actions/workspace_actions.py:5 ⧉ from components.occupational_health.internal.models.occupational_health_profile import ( # noqa: ALN069
components/occupational_health/internal/business_logic/doctolib/queries.py:29 ⧉ from components.fr.internal.models.user import User # noqa: ALN069
components/occupational_health/external/employment_component.py:19 ⧉ from components.fr.internal.models.employment import ( # noqa: ALN069
components/occupational_health/external/employment_component.py:50 ⧉ from components.fr.internal.models.employment import ( # noqa: ALN069

ALN043 occurs 9 times

File:line Content
components/occupational_health/conftest.py:42 ⧉ from components.affiliation_occ_health.bootstrap.bootstrap import ( # noqa: ALN043 # can't really import this otherwise
components/occupational_health/conftest.py:45 ⧉ from components.employment.bootstrap.bootstrap import ( # noqa: ALN043 # can't really import this otherwise
components/occupational_health/conftest.py:48 ⧉ from components.global_profile.bootstrap.bootstrap import ( # noqa: ALN043 # can't really import this otherwise
components/occupational_health/internal/business_logic/queries/affiliation/affiliation_tool.py:16 ⧉ from components.fr.internal.fr_employment_data_sources.entities.user_matching_result import ( # noqa: ALN043 - function should be made public (or existing global one made compatible)
components/occupational_health/internal/business_logic/queries/affiliation/affiliation_tool.py:570 ⧉ from components.fr.internal.fr_employment_data_sources.business_logic.queries.user import ( # noqa: ALN043 - function should be made public (or existing global one made compatible)
components/occupational_health/internal/business_logic/queries/affiliation/affiliation_tool.py:573 ⧉ from components.fr.internal.fr_employment_data_sources.entities.employee_personal_informations import ( # noqa: ALN043 - function should be made public (or existing global one made compatible)
components/occupational_health/internal/business_logic/doctolib/queries.py:12 ⧉ from components.fr.internal.business_logic.search import ( # noqa: ALN039,ALN043
components/occupational_health/public/queries/doctolib_user_matching_v1.py:12 ⧉ from components.fr.internal.business_logic.search import ( # noqa: ALN039,ALN043
components/occupational_health/external/employment_component.py:47 ⧉ from components.fr.internal.fr_employment_data_sources.business_logic.global_affiliation_transition.backfill import ( # noqa: ALN043

ALN039 occurs 2 times

File:line Content
components/occupational_health/internal/business_logic/doctolib/queries.py:12 ⧉ from components.fr.internal.business_logic.search import ( # noqa: ALN039,ALN043
components/occupational_health/public/queries/doctolib_user_matching_v1.py:12 ⧉ from components.fr.internal.business_logic.search import ( # noqa: ALN039,ALN043