zulip/zerver
Anders Kaseorg 6988622fe8 ruff: Enable B023 Function definition does not bind loop variable.
Python’s loop scoping is misdesigned, resulting in a very common
gotcha for functions that close over loop variables [1].  The general
problem is so bad that even the Go developers plan to break
compatibility in order to fix the same design mistake in their
language [2].

Enable the Ruff rule function-uses-loop-variable (B023) [3], which
conservatively prohibits functions from binding loop variables at all.

[1] https://docs.python-guide.org/writing/gotchas/#late-binding-closures
[2] https://go.dev/s/loopvar-design
[3] https://beta.ruff.rs/docs/rules/function-uses-loop-variable/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:03:45 -07:00
..
actions models: Always search Messages with a realm_id or id limit. 2023-09-11 15:00:37 -07:00
data_import python: Replace functools.partial with type-safe returns.curry.partial. 2023-09-11 18:03:45 -07:00
integration_fixtures/nagios
lib ruff: Enable B023 Function definition does not bind loop variable. 2023-09-11 18:03:45 -07:00
management ruff: Enable B023 Function definition does not bind loop variable. 2023-09-11 18:03:45 -07:00
migrations migrations: Remove indexes on Message without realm_id. 2023-09-11 15:00:37 -07:00
openapi events: Send invites changes event to non-admin users also. 2023-09-07 14:21:01 -07:00
tests ruff: Enable B023 Function definition does not bind loop variable. 2023-09-11 18:03:45 -07:00
tornado ruff: Enable B023 Function definition does not bind loop variable. 2023-09-11 18:03:45 -07:00
transaction_tests docs: Fix typos caught by ‘typos’. 2023-09-06 18:59:05 -07:00
views python: Replace functools.partial with type-safe returns.curry.partial. 2023-09-11 18:03:45 -07:00
webhooks python: Replace functools.partial with type-safe returns.curry.partial. 2023-09-11 18:03:45 -07:00
worker python: Replace functools.partial with type-safe returns.curry.partial. 2023-09-11 18:03:45 -07:00
__init__.py
apps.py requirements: Upgrade Python requirements. 2023-04-03 22:39:21 -07:00
context_processors.py emails: Add corporate_enabled to context for emails. 2023-05-01 10:32:43 -07:00
decorator.py logging_util: Remove dependence on get_current_request. 2023-07-11 22:23:47 -07:00
filters.py error_notify: Remove custom email error reporting handler. 2023-07-20 11:00:09 -07:00
forms.py python: Convert translated positional {} fields to {named} fields. 2023-07-18 15:19:07 -07:00
logging_handlers.py error_notify: Remove custom email error reporting handler. 2023-07-20 11:00:09 -07:00
middleware.py middleware: Fix exception logging format on JSON views. 2023-09-06 09:14:49 -07:00
models.py migrations: Remove indexes on Message without realm_id. 2023-09-11 15:00:37 -07:00
signals.py demo-orgs: Create dev environment demo organization without email. 2023-08-31 15:02:16 -07:00