1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 01:48:17 +00:00
trezor-firmware/tools/trezor-pylint-plugin
matejcik f0d6539d3d feat: custom Pylint plugin
for now, it catches the following incorrect function:

async def show_foo() -> Awaitable[None]:
    return show_something_else("foo")

because to correctly show the result, the caller would have to "await (await show_foo())"

(this should either be "async def show_foo() -> None", or "def show_foo() -> Awaitable[None]")
2023-11-30 09:27:57 +01:00
..
.gitignore feat: custom Pylint plugin 2023-11-30 09:27:57 +01:00
pyproject.toml feat: custom Pylint plugin 2023-11-30 09:27:57 +01:00
README.md feat: custom Pylint plugin 2023-11-30 09:27:57 +01:00
trezor_pylint_plugin.py feat: custom Pylint plugin 2023-11-30 09:27:57 +01:00

Custom Pylint rule checker

For now, it catches the following problem (async-awaitable-return):

async def show_foo() -> Awaitable[None]:
    return show_something("foo")

This is almost certainly a mistake -- the caller would need to say await (await show_foo()) to actually show the foo.

The function should be one of:

async def show_foo() -> None:
    return await show_something("foo")

# ... or ...

def show_foo() -> Awaitable[None]:
    return show_something("foo")