utils: checkstyle.py: Drop period at end of Doxygen one liners

The libcamera documentation style calls for no period at the end of the
Doxygen one-liner commands (\brief, \param and \return). Extend the
DoxygenFormatter class to drop the period.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2024-04-16 13:09:17 +03:00
parent fef732d4dc
commit 7d79e9425e

View file

@ -753,6 +753,7 @@ class CLangFormatter(Formatter):
class DoxygenFormatter(Formatter): class DoxygenFormatter(Formatter):
patterns = ('*.c', '*.cpp') patterns = ('*.c', '*.cpp')
oneliner_regex = re.compile(r'^ +\* +\\(brief|param|return)\b.*\.$')
return_regex = re.compile(r' +\* +\\return +[a-z]') return_regex = re.compile(r' +\* +\\return +[a-z]')
@classmethod @classmethod
@ -768,6 +769,7 @@ class DoxygenFormatter(Formatter):
lines.append(line) lines.append(line)
continue continue
line = cls.oneliner_regex.sub(lambda m: m.group(0)[:-1], line)
line = cls.return_regex.sub(lambda m: m.group(0)[:-1] + m.group(0)[-1].upper(), line) line = cls.return_regex.sub(lambda m: m.group(0)[:-1] + m.group(0)[-1].upper(), line)
if line.find('*/') != -1: if line.find('*/') != -1: