Skip to content

Commit 6cc45ee

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: kdoc: some fixes to kernel-doc comments
There are some typos and English errors in the comments of kernel‑doc.py. Locate them with the help of an LLM (gpt‑oss 14B), executed locally with this prompt: review English grammar and syntax at the comments on the code below: <cat scripts/kernel-doc.py> While LLM worked fine for the task of doing an English grammar review for strings, being able to distinguish them from the actual code, it was not is perfect: some things required manual work to fix. - While here, replace: "/**" with: ``/**`` As, if we ever rename this script to kernel_doc.py and add it to Sphinx ext autodoc, we want to avoid this warning: scripts/kernel_doc.py:docstring of kernel_doc:10: WARNING: Inline strong start-string without end-string. [docutils] Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <ec08727f22ad35e6c58519c1f425f216f14b701c.1768823489.git.mchehab+huawei@kernel.org>
1 parent bd28e99 commit 6cc45ee

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

scripts/kernel-doc.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
# The rationale is that it shall fail gracefully during Kernel
1010
# compilation with older Kernel versions. Due to that:
1111
# - encoding line is needed here;
12-
# - no f-strings can be used on this file.
13-
# - the libraries that require newer versions can only be included
14-
# after Python version is checked.
12+
# - f-strings cannot be used in this file.
13+
# - libraries that require newer versions can only be included
14+
# after the Python version has been checked.
1515
#
1616
# Converted from the kernel-doc script originally written in Perl
1717
# under GPLv2, copyrighted since 1998 by the following authors:
@@ -88,16 +88,13 @@
8888
# Yujie Liu <yujie.liu@intel.com>
8989

9090
"""
91-
kernel_doc
92-
==========
93-
94-
Print formatted kernel documentation to stdout
91+
Print formatted kernel documentation to stdout.
9592
9693
Read C language source or header FILEs, extract embedded
9794
documentation comments, and print formatted documentation
9895
to standard output.
9996
100-
The documentation comments are identified by the "/**"
97+
The documentation comments are identified by the ``/**``
10198
opening comment mark.
10299
103100
See Documentation/doc-guide/kernel-doc.rst for the
@@ -134,13 +131,13 @@
134131
"""
135132

136133
EXPORT_DESC = """
137-
Only output documentation for the symbols that have been
134+
Only output documentation for symbols that have been
138135
exported using EXPORT_SYMBOL() and related macros in any input
139136
FILE or -export-file FILE.
140137
"""
141138

142139
INTERNAL_DESC = """
143-
Only output documentation for the symbols that have NOT been
140+
Only output documentation for symbols that have NOT been
144141
exported using EXPORT_SYMBOL() and related macros in any input
145142
FILE or -export-file FILE.
146143
"""
@@ -163,15 +160,15 @@
163160
"""
164161

165162
WARN_CONTENTS_BEFORE_SECTIONS_DESC = """
166-
Warns if there are contents before sections (deprecated).
163+
Warn if there are contents before sections (deprecated).
167164
168165
This option is kept just for backward-compatibility, but it does nothing,
169166
neither here nor at the original Perl script.
170167
"""
171168

172169

173170
class MsgFormatter(logging.Formatter):
174-
"""Helper class to format warnings on a similar way to kernel-doc.pl"""
171+
"""Helper class to format warnings in a similar way to kernel-doc.pl."""
175172

176173
def format(self, record):
177174
record.levelname = record.levelname.capitalize()
@@ -273,7 +270,7 @@ def main():
273270
help=NOSYMBOL_DESC)
274271

275272
parser.add_argument("-D", "-no-doc-sections", "--no-doc-sections",
276-
action='store_true', help="Don't outputt DOC sections")
273+
action='store_true', help="Don't output DOC sections")
277274

278275
parser.add_argument("files", metavar="FILE",
279276
nargs="+", help=FILES_DESC)
@@ -302,12 +299,12 @@ def main():
302299
python_ver = sys.version_info[:2]
303300
if python_ver < (3,6):
304301
#
305-
# Depending on Kernel configuration, kernel-doc --none is called at
302+
# Depending on the Kernel configuration, kernel-doc --none is called at
306303
# build time. As we don't want to break compilation due to the
307304
# usage of an old Python version, return 0 here.
308305
#
309306
if args.none:
310-
logger.error("Python 3.6 or later is required by kernel-doc. skipping checks")
307+
logger.error("Python 3.6 or later is required by kernel-doc. Skipping checks")
311308
sys.exit(0)
312309

313310
sys.exit("Python 3.6 or later is required by kernel-doc. Aborting.")
@@ -316,7 +313,7 @@ def main():
316313
logger.warning("Python 3.7 or later is required for correct results")
317314

318315
#
319-
# Import kernel-doc libraries only after checking Python version
316+
# Import kernel-doc libraries only after checking the Python version
320317
#
321318
from kdoc.kdoc_files import KernelFiles # pylint: disable=C0415
322319
from kdoc.kdoc_output import RestFormat, ManFormat # pylint: disable=C0415

0 commit comments

Comments
 (0)