]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
scripts: generate_rust_analyzer.py: add type hints
authorTamir Duberstein <tamird@kernel.org>
Thu, 22 Jan 2026 17:30:47 +0000 (12:30 -0500)
committerTamir Duberstein <tamird@kernel.org>
Mon, 9 Mar 2026 17:20:08 +0000 (13:20 -0400)
commit94a3b2d9877eee2f8b5b41a51d99b7860efbd34d
tree5bd8b000402662d93d2166aa7ebb90805ad1f65d
parent4079cf049cb265c15c3c7349d85943462ba054d5
scripts: generate_rust_analyzer.py: add type hints

Python type hints allow static analysis tools like mypy to detect type
errors during development, improving the developer experience.

Python type hints have been present in the kernel since 2019 at the
latest; see commit 6ebf5866f2e8 ("kunit: tool: add Python wrappers for
running KUnit tests").

Add a subclass of `argparse.Namespace` to get type checking on the CLI
arguments.

Run `mypy --strict scripts/generate_rust_analyzer.py --python-version
3.9` to verify. Note that `mypy` no longer supports python < 3.9.

Tested-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Trevor Gross <tmgross@umich.edu>
Reviewed-by: Jesung Yang <y.j3ms.n@gmail.com>
Tested-by: Jesung Yang <y.j3ms.n@gmail.com>
Link: https://patch.msgid.link/20260122-rust-analyzer-types-v1-3-29cc2e91dcd5@kernel.org
Signed-off-by: Tamir Duberstein <tamird@kernel.org>
scripts/generate_rust_analyzer.py