From 4dd857723b298512d22c6626e6bdc6d8c4b05234 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 19 Feb 2021 18:01:50 -0800 Subject: [PATCH] Documentation/coding_style: Issues not mentioned and cleanup patches This patch adds a bit of a "preamble" to the coding style to provide guideance on how it should be applied and how style questions that aren't mentioned should be handled. Signed-off-by: Julius Werner Change-Id: I88efd5f1006bd1fd82cea14ea65422d9958dc197 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50966 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- Documentation/contributing/coding_style.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Documentation/contributing/coding_style.md b/Documentation/contributing/coding_style.md index f6a0f540b80a..a8c7356bfebe 100644 --- a/Documentation/contributing/coding_style.md +++ b/Documentation/contributing/coding_style.md @@ -5,12 +5,26 @@ coreboot project. It is in many ways exactly the same as the Linux kernel coding style. In fact, most of this document has been copied from the [Linux kernel coding style](http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/CodingStyle?id=HEAD) -Please at least consider the points made here. +The guidelines in this file should be seen as a strong suggestion, and +should overrule personal preference. But they may be ignored in +individual instances when there are good practical reasons to do so, and +reviewers are in agreement. -First off, I'd suggest printing out a copy of the GNU coding standards, -and NOT read it. Burn them, it's a great symbolic gesture. +Any style questions that are not mentioned in here should be decided +between the author and reviewers on a case-by-case basis. When modifying +existing files, authors should try to match the prevalent style in that +file -- otherwise, they should try to match similar existing files in +coreboot. -Anyway, here goes: +Bulk style changes to existing code ("cleanup patches") should avoid +changing existing style choices unless they actually violate this style +guide, or there is broad consensus that the new version is an +improvement. By default the style choices of the original author should +be honored. (Note that `checkpatch.pl` is not part of this style guide, +and neither is `clang-format`. These tools can be useful to find +potential issues or simplify formatting in new submissions, but they +were not designed to directly match this guide and may have false +positives. They should not be bulk-applied to change existing code.) ## Indentation