synapse/tests/http
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
..
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
server Fix cancellation tests with new Twisted. (#17906) 2024-11-07 15:26:14 +00:00
__init__.py Update license headers 2023-11-21 15:29:58 -05:00
ca.crt Tests for SSL certs for federation connections 2019-06-10 16:14:20 +01:00
ca.key Tests for SSL certs for federation connections 2019-06-10 16:14:20 +01:00
server.key Tests for SSL certs for federation connections 2019-06-10 16:14:20 +01:00
test_additional_resource.py Update license headers 2023-11-21 15:29:58 -05:00
test_client.py Format files with Ruff (#17643) 2024-09-02 12:39:04 +01:00
test_endpoint.py Update license headers 2023-11-21 15:29:58 -05:00
test_matrixfederationclient.py Bump ruff from 0.7.3 to 0.11.10 (#18451) 2025-05-20 15:23:30 +01:00
test_proxy.py Remove usage of internal header encoding API (#17894) 2024-11-04 12:20:07 -06:00
test_proxyagent.py 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
test_servlet.py Format files with Ruff (#17643) 2024-09-02 12:39:04 +01:00
test_simple_client.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_site.py Don't allow unsupported content-type 2024-12-03 09:53:21 +01:00