33# Copyright(c) 2025: Mauro Carvalho Chehab <mchehab@kernel.org>.
44#
55# pylint: disable=C0103,R0912,R0914,R0915
6-
6+ #
77# NOTE: While kernel-doc requires at least version 3.6 to run, the
88# command line should work with Python 3.2+ (tested with 3.4).
99# The rationale is that it shall fail gracefully during Kernel
1212# - no f-strings can be used on this file.
1313# - the libraries that require newer versions can only be included
1414# after Python version is checked.
15-
15+ #
1616# Converted from the kernel-doc script originally written in Perl
1717# under GPLv2, copyrighted since 1998 by the following authors:
1818#
@@ -197,8 +197,9 @@ def main():
197197 parser = argparse .ArgumentParser (formatter_class = argparse .RawTextHelpFormatter ,
198198 description = DESC )
199199
200+ #
200201 # Normal arguments
201-
202+ #
202203 parser .add_argument ("-v" , "-verbose" , "--verbose" , action = "store_true" ,
203204 help = "Verbose output, more warnings and other information." )
204205
@@ -213,8 +214,9 @@ def main():
213214 action = "store_true" ,
214215 help = "Enable line number output (only in ReST mode)" )
215216
217+ #
216218 # Arguments to control the warning behavior
217-
219+ #
218220 parser .add_argument ("-Wreturn" , "--wreturn" , action = "store_true" ,
219221 help = "Warns about the lack of a return markup on functions." )
220222
@@ -235,8 +237,9 @@ def main():
235237 parser .add_argument ("-export-file" , "--export-file" , action = 'append' ,
236238 help = EXPORT_FILE_DESC )
237239
240+ #
238241 # Output format mutually-exclusive group
239-
242+ #
240243 out_group = parser .add_argument_group ("Output format selection (mutually exclusive)" )
241244
242245 out_fmt = out_group .add_mutually_exclusive_group ()
@@ -248,8 +251,9 @@ def main():
248251 out_fmt .add_argument ("-N" , "-none" , "--none" , action = "store_true" ,
249252 help = "Do not output documentation, only warnings." )
250253
254+ #
251255 # Output selection mutually-exclusive group
252-
256+ #
253257 sel_group = parser .add_argument_group ("Output selection (mutually exclusive)" )
254258 sel_mut = sel_group .add_mutually_exclusive_group ()
255259
@@ -262,7 +266,9 @@ def main():
262266 sel_mut .add_argument ("-s" , "-function" , "--symbol" , action = 'append' ,
263267 help = FUNCTION_DESC )
264268
269+ #
265270 # Those are valid for all 3 types of filter
271+ #
266272 parser .add_argument ("-n" , "-nosymbol" , "--nosymbol" , action = 'append' ,
267273 help = NOSYMBOL_DESC )
268274
@@ -295,9 +301,11 @@ def main():
295301
296302 python_ver = sys .version_info [:2 ]
297303 if python_ver < (3 ,6 ):
304+ #
298305 # Depending on Kernel configuration, kernel-doc --none is called at
299306 # build time. As we don't want to break compilation due to the
300307 # usage of an old Python version, return 0 here.
308+ #
301309 if args .none :
302310 logger .error ("Python 3.6 or later is required by kernel-doc. skipping checks" )
303311 sys .exit (0 )
@@ -307,7 +315,9 @@ def main():
307315 if python_ver < (3 ,7 ):
308316 logger .warning ("Python 3.7 or later is required for correct results" )
309317
318+ #
310319 # Import kernel-doc libraries only after checking Python version
320+ #
311321 from kdoc .kdoc_files import KernelFiles # pylint: disable=C0415
312322 from kdoc .kdoc_output import RestFormat , ManFormat # pylint: disable=C0415
313323
@@ -346,6 +356,8 @@ def main():
346356
347357 sys .exit (0 )
348358
359+ #
349360# Call main method
361+ #
350362if __name__ == "__main__" :
351363 main ()
0 commit comments