mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>,
	Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	linux-kernel@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: [PATCH 13/25] docs: kdoc: enrich_formatter: Improve docstrings and comments
Date: Mon, 19 Jan 2026 17:23:16 +0100	[thread overview]
Message-ID: <55ec8b896fe00529d326859cd094230fb5a2cd30.1768838938.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1768838938.git.mchehab+huawei@kernel.org>

In preparation to document kernel-doc module, improve its
documentation.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 tools/lib/python/kdoc/enrich_formatter.py | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/tools/lib/python/kdoc/enrich_formatter.py b/tools/lib/python/kdoc/enrich_formatter.py
index bb171567a4ca..d1be4e5e1962 100644
--- a/tools/lib/python/kdoc/enrich_formatter.py
+++ b/tools/lib/python/kdoc/enrich_formatter.py
@@ -26,12 +26,16 @@ class EnrichFormatter(argparse.HelpFormatter):
     and how they're used at the __doc__ description.
     """
     def __init__(self, *args, **kwargs):
-        """Initialize class and check if is TTY"""
+        """
+        Initialize class and check if is TTY.
+        """
         super().__init__(*args, **kwargs)
         self._tty = sys.stdout.isatty()
 
     def enrich_text(self, text):
-        """Handle ReST markups (currently, only ``foo``)"""
+        r"""
+        Handle ReST markups (currently, only \`\`text\`\` markups).
+        """
         if self._tty and text:
             # Replace ``text`` with ANSI SGR (bold)
             return re.sub(r'\`\`(.+?)\`\`',
@@ -39,12 +43,16 @@ class EnrichFormatter(argparse.HelpFormatter):
         return text
 
     def _fill_text(self, text, width, indent):
-        """Enrich descriptions with markups on it"""
+        """
+        Enrich descriptions with markups on it.
+        """
         enriched = self.enrich_text(text)
         return "\n".join(indent + line for line in enriched.splitlines())
 
     def _format_usage(self, usage, actions, groups, prefix):
-        """Enrich positional arguments at usage: line"""
+        """
+        Enrich positional arguments at usage: line.
+        """
 
         prog = self._prog
         parts = []
@@ -63,7 +71,9 @@ class EnrichFormatter(argparse.HelpFormatter):
         return usage_text
 
     def _format_action_invocation(self, action):
-        """Enrich argument names"""
+        """
+        Enrich argument names.
+        """
         if not action.option_strings:
             return self.enrich_text(f"``{action.dest.upper()}``")
 
-- 
2.52.0


  parent reply	other threads:[~2026-01-19 16:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19 16:23 [PATCH 00/25] Add tools/lib/python modules to Documentation/tools Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 01/25] docs: custom.css: prevent li marker to override text Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 02/25] docs: conf.py: don't use doctree with a different meaning Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 03/25] docs: conf: don't rely on cwd to get documentation location Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 04/25] docs: enable Sphinx autodoc extension to allow documenting python Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 05/25] docs: custom.css: add CSS for python Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 06/25] docs: kdoc: latex_fonts: Improve docstrings and comments Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 07/25] docs: kdoc_files: " Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 08/25] docs: kdoc_item: " Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 09/25] docs: kdoc_parser: " Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 10/25] docs: kdoc_output: " Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 11/25] docs: kdoc_re: " Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 12/25] docs: kdoc: parse_data_structs: " Mauro Carvalho Chehab
2026-01-19 16:23 ` Mauro Carvalho Chehab [this message]
2026-01-19 16:23 ` [PATCH 14/25] docs: kdoc: python_version: " Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 15/25] docs: add kernel-doc modules documentation Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 16/25] docs: add kabi " Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 17/25] docs: python: abi_parser: do some improvements at documentation Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 18/25] docs: python: abi_regex: " Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 19/25] docs: kabi: system_symbols: end docstring phrases with a dot Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 20/25] docs: kabi: helpers: add helper for debug bits 7 and 8 Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 21/25] docs: kabi: helpers: add documentation for each "enum" value Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 22/25] docs: add jobserver module documentation Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 23/25] docs: jobserver: do some documentation improvements Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 24/25] docs: add parse_features module documentation Mauro Carvalho Chehab
2026-01-19 16:23 ` [PATCH 25/25] docs: parse_features: make documentation more consistent Mauro Carvalho Chehab
2026-01-23 18:47 ` [PATCH 00/25] Add tools/lib/python modules to Documentation/tools Jonathan Corbet
2026-01-24  0:31   ` Akira Yokosawa
2026-01-24  5:54     ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55ec8b896fe00529d326859cd094230fb5a2cd30.1768838938.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®