From patchwork Thu May 26 11:00:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16060 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 59F86C3256 for ; Thu, 26 May 2022 11:00:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4FB3265668; Thu, 26 May 2022 13:00:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653562821; bh=LvRr4TI/9314rdTW4KMcUAJ33PEj+tUuERzn4R7Ick8=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=O4+39/JZr79DW9yW++xDMZkrxldFHXTH4QXQzunwDTXqr6ZduxIJURrueIeaJ2S+n zmVuooHGoBnN4Bvg7qp1fx79fOBQtr1hNnqK0ma1CMEPSlBDH5D+CF09NOkSin2WGt Ot5KxaprmaogcZOIhzyE52U6wju8b8mvieA7d6KYc3MIB31dbMOWBK4ULsrWgD43t2 debWpJHSs1W6rjftQfhVNh7KZhfscv36Kl4XIiQiwFRjCdbzBMmvAARp7DCMelFWPg 23nT8974v2qq6ob0/xYnoGvpugg6T45fDTR0hc74kxl3R/NqSQj1/ZO9AGY/rIi/I8 OHx+W08UK+VbQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5273D65660 for ; Thu, 26 May 2022 13:00:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jm7Bf4qf"; dkim-atps=neutral Received: from pendragon.lan (unknown [37.120.212.14]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E2A53898 for ; Thu, 26 May 2022 13:00:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1653562819; bh=LvRr4TI/9314rdTW4KMcUAJ33PEj+tUuERzn4R7Ick8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jm7Bf4qf5bV6EjZ2OW0sNTw4UfpJbdsfgAslbASW7zUP/WOJGWBDSUWBjeI8jDbGG aZh28f/akjsmHIuiR4EHyNbVr7pa8Ec9uE6pxQ1X+FJAH8Ogf5e8p1boBreXta1okX LgsUTJruTOQzOUe3NaVPTscw8jg4cp32vUx1uQXo= To: libcamera-devel@lists.libcamera.org Date: Thu, 26 May 2022 14:00:07 +0300 Message-Id: <20220526110009.13874-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220526110009.13874-1-laurent.pinchart@ideasonboard.com> References: <20220526110009.13874-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] utils: checkstyle: Run the ClangFormatter last X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Umang Jain Reviewed-by: Paul Elder --- utils/checkstyle.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 835f2a9fcd71..66af96abd402 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):