Re: [PATCH v8 04/13] tools: ynl_gen_rst.py: cleanup coding style

Donald Hunter
2025-06-27T11:05:00Z

Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:

> @staticmethod
> def rst_ref(namespace: str, prefix: str, name: str) -> str:
> """Add a hyperlink to the document"""
> @@ -119,10 +100,9 @@ class RstFormatters:
> 'nested-attributes': 'attribute-set',
> 'struct': 'definition'}
> if prefix in mappings:
> - prefix = mappings[prefix]
> + prefix = mappings.get(prefix, "")

This gives me a sad face because fixing the erroneous pylint warning
makes the code look worse. I'd prefer to either suppress the warning
or to change this:

if prefix in mappings:
prefix = mappings[prefix]

to this:

prefix = mappings.get(prefix, prefix)

But IMHO the intent of the original is clearer.