synapse/tests
Quentin Gliech 0de7aa9953
Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542)
This can be reviewed commit by commit.

This enables the `flake8-logging` and `flake8-logging-format` rules in
Ruff, as well as logging exception stack traces in a few places where it
makes sense

 - https://docs.astral.sh/ruff/rules/#flake8-logging-log
 - https://docs.astral.sh/ruff/rules/#flake8-logging-format-g

### Linting to avoid pre-formatting log messages

See [`adamchainz/flake8-logging` -> *LOG011 avoid pre-formatting log
messages*](152db2f167/README.rst (log011-avoid-pre-formatting-log-messages))

Practically, this means prefer placeholders (`%s`) over f-strings for
logging.

This is because placeholders are passed as args to loggers, so they can
do special handling of them.
For example, Sentry will record the args separately in their logging
integration:
c15b390dfe/sentry_sdk/integrations/logging.py (L280-L284)

One theoretical small perf benefit is that log levels that aren't
enabled won't get formatted, so it doesn't unnecessarily create
formatted strings
2025-06-13 09:44:18 +02:00
..
api Export RatelimitOverride from ModuleApi (#18513) 2025-06-06 10:48:49 +00:00
app Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
appservice Recover an appservice if a successful ping occurs. (#18521) 2025-06-06 11:59:38 +00:00
config Fix a couple type annotations in the RootConfig/Config (#18409) 2025-05-13 10:22:15 -05:00
crypto Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
events Fix a couple type annotations in the RootConfig/Config (#18409) 2025-05-13 10:22:15 -05:00
federation Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
handlers Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
http Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
logging Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
media Add media repository callbacks to module API to control media upload size (#18457) 2025-06-04 11:33:10 +01:00
metrics Add a unit test for the phone home stats (#18463) 2025-05-20 16:26:45 +01:00
module_api Add user_may_send_state_event callback to spam checker module API (#18455) 2025-06-04 11:26:04 +00:00
push Do not retry push during backoff period (#18363) 2025-04-29 14:08:11 +01:00
replication Bump ruff from 0.7.3 to 0.11.10 (#18451) 2025-05-20 15:23:30 +01:00
rest Add media repository callbacks to module API to control media upload size (#18457) 2025-06-04 11:33:10 +01:00
scripts Update license headers 2023-11-21 15:29:58 -05:00
server_notices Sliding Sync: Add cache to get_tags_for_room(...) (#17730) 2024-09-19 12:43:26 +01:00
state bugfix: ensure _get_power_level_for_sender works when there is no PL event (#18534) 2025-06-10 15:11:49 +01:00
storage Don't allow users to ignore themselves. (#18508) 2025-06-06 15:37:15 +01:00
test_utils Bump ruff from 0.7.3 to 0.11.10 (#18451) 2025-05-20 15:23:30 +01:00
types Use immutabledict instead of frozendict (#15113) 2023-03-22 17:15:34 +00:00
util Migrate to assertEqual (#18488) 2025-06-06 16:14:09 +01:00
__init__.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
server.py Bump ruff from 0.7.3 to 0.11.10 (#18451) 2025-05-20 15:23:30 +01:00
test_distributor.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_event_auth.py Format files with Ruff (#17643) 2024-09-02 12:39:04 +01:00
test_mau.py Update license headers 2023-11-21 15:29:58 -05:00
test_phone_home.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_rust.py Add missing type hints to tests. (#15027) 2023-02-08 19:52:37 +00:00
test_server.py Removal: Remove support for experimental msc3886 (#17638) 2024-11-13 14:10:20 +00:00
test_state.py Bump ruff from 0.7.3 to 0.11.10 (#18451) 2025-05-20 15:23:30 +01:00
test_terms_auth.py Update license headers 2023-11-21 15:29:58 -05:00
test_test_utils.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_types.py Format files with Ruff (#17643) 2024-09-02 12:39:04 +01:00
test_visibility.py Include user membership on events (#17282) 2024-06-13 21:45:54 +00:00
unittest.py Cleanup Python 3.8 leftovers (#17967) 2025-02-10 16:53:24 +00:00
utils.py Cleanup Python 3.8 leftovers (#17967) 2025-02-10 16:53:24 +00:00