element-hq / element-hq/synapse

Get synapse/ to pass mypy

Open
#11,271 0 comments 0 reactions 0 assignees View on GitHub
O-Uncommon S-Minor T-Task Z-Dev-Wishlist
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#11271](https://github.com/matrix-org/synapse/issues/11271).

---

Our mypy configuration currently includes an explicit [enumeration](https://github.com/matrix-org/synapse/blob/4249082eed54a0fe6412ab303409511ea759dd76/mypy.ini#L28-L30) of files to check. That list covers 409 of the 491 Python files in the `synapse/` directory.

We should:

- Get as many of those to pass as possible
- Invert the selection criteria so that all files in `synapse/` are checked by default, while failing files are explicitly excluded.

As of 4249082eed54a0fe6412ab303409511ea759dd76, the omitted files are:

- `storage/databases/__init__.py`
- `storage/databases/main/cache.py`
- `storage/schema/*` (25 files)

We should probably start with switching from inclusion to exclusion, and burn down from there. Note that the next release of mypy will have [significantly better](https://github.com/python/mypy/pull/11329) syntax for multiple exclusions, but it's not out yet, so we'll have to get by with gnarlier regex-based syntax.

(Edited 2022-08-30 by dmr to reflect the status quo.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.