python / mypy

Optional static typing for Python
https://www.mypy-lang.org/
Other
18.55k stars 2.84k forks source link

ruff: enable pep8-naming rules #18144

Closed brianschubert closed 1 week ago

brianschubert commented 2 weeks ago

The vast majority of mypy's code follows PEP 8 naming conventions. However, we currently don't enforce this in the linter config. I noticed this in a recent PR which included a camelCase name: https://github.com/python/mypy/pull/18132#discussion_r1836870819.

Ruff has some rules to enforce PEP 8 naming style (pep8-naming). I think it would be a good idea to enable some of these to help contributors catch naming discrepancies before PR review.

We have a few notable exceptions to PEP 8 naming (e.g. functions named to match ast node names), but these are easily accounted for with some config file ignores and handful of # noqa's.

github-actions[bot] commented 2 weeks ago

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅