Skip to content

Code quality

ALN** occurrences by order of importance

NOQA Number of occurrences
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. 18
ALN096: Do not set auth headers (Authorization, CF-Access-*, X-Api-Key) inline in HTTP calls. Use a requests.auth.AuthBase subclass instead. This centralizes auth logic, makes credentials easier to rotate, and prevents accidental leaks in logs. Bad: requests.get(url, headers={"Authorization": f"Bearer {token}"}) Good: class BearerAuth(requests.auth.AuthBase): def init(self, token: str) -> None: self.token = token def call(self, r: requests.PreparedRequest) -> requests.PreparedRequest: r.headers["Authorization"] = f"Bearer {self.token}" return r requests.get(url, auth=BearerAuth(token)) 1

Listing of files of the most critical ALN**