summaryrefslogtreecommitdiff
path: root/utils/checkstyle.py
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-05-26 13:32:00 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-06-01 12:08:29 +0300
commitc58ac2f4984f63e8b9cbbdfea04fb3d8ecfccac1 (patch)
tree146c9b171d85f4de80d7d0fd008dd4e195469017 /utils/checkstyle.py
parent2094ac4f8cf7c437d4ce8e35eef749f24f6f551e (diff)
utils: checkstyle: Run the CLangFormatter last
The IncludeOrderFormatter will be extended with more formatting rules that should be applied before clang-format gets run, as it will influence its output. Add a priority mechanism for formatters, and give a negative priority to the CLangFormatter to make it run last. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'utils/checkstyle.py')
-rwxr-xr-xutils/checkstyle.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils/checkstyle.py b/utils/checkstyle.py
index 835f2a9f..66af96ab 100755
--- a/utils/checkstyle.py
+++ b/utils/checkstyle.py
@@ -279,6 +279,8 @@ class ClassRegistry(type):
newclass = super().__new__(cls, clsname, bases, attrs)
if bases:
bases[0].subclasses.append(newclass)
+ bases[0].subclasses.sort(key=lambda x: getattr(x, 'priority', 0),
+ reverse=True)
return newclass
@@ -568,6 +570,7 @@ class Formatter(metaclass=ClassRegistry):
class CLangFormatter(Formatter):
patterns = ('*.c', '*.cpp', '*.h')
+ priority = -1
@classmethod
def format(cls, filename, data):