diff options
Diffstat (limited to 'utils/checkstyle.py')
-rwxr-xr-x | utils/checkstyle.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 84f44a42..4e287b2e 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -4,7 +4,7 @@ # # Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # -# checkstyle.py - A patch style checker script based on clang-format +# A patch style checker script based on clang-format # # TODO: # @@ -569,7 +569,7 @@ class IncludeChecker(StyleChecker): 'limits', 'locale', 'setjmp', 'signal', 'stdarg', 'stddef', 'stdint', 'stdio', 'stdlib', 'string', 'time', 'uchar', 'wchar', 'wctype') - include_regex = re.compile('^#include <c([a-z]*)>') + include_regex = re.compile(r'^#include <c([a-z]*)>') def __init__(self, content): super().__init__() @@ -632,7 +632,7 @@ class MesonChecker(StyleChecker): class Pep8Checker(StyleChecker): patterns = ('*.py',) - results_regex = re.compile('stdin:([0-9]+):([0-9]+)(.*)') + results_regex = re.compile(r'stdin:([0-9]+):([0-9]+)(.*)') def __init__(self, content): super().__init__() @@ -665,7 +665,7 @@ class Pep8Checker(StyleChecker): class ShellChecker(StyleChecker): patterns = ('*.sh',) - results_line_regex = re.compile('In - line ([0-9]+):') + results_line_regex = re.compile(r'In - line ([0-9]+):') def __init__(self, content): super().__init__() @@ -753,7 +753,8 @@ class CLangFormatter(Formatter): class DoxygenFormatter(Formatter): patterns = ('*.c', '*.cpp') - return_regex = re.compile(' +\\* +\\\\return +[a-z]') + oneliner_regex = re.compile(r'^ +\* +\\(brief|param|return)\b.*\.$') + return_regex = re.compile(r' +\* +\\return +[a-z]') @classmethod def format(cls, filename, data): @@ -768,6 +769,7 @@ class DoxygenFormatter(Formatter): lines.append(line) 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) if line.find('*/') != -1: @@ -813,7 +815,7 @@ class DPointerFormatter(Formatter): class IncludeOrderFormatter(Formatter): patterns = ('*.cpp', '*.h') - include_regex = re.compile('^#include (["<])([^">]*)([">])') + include_regex = re.compile(r'^#include (["<])([^">]*)([">])') @classmethod def format(cls, filename, data): |