The clang-format CI job is currently cluttered due to too many errors being reported. See some of the examples here: * https://gitlab.com/gitlab-org/git/-/jobs/7854601948 * https://gitlab.com/gitlab-org/git/-/jobs/7843131109 So modify the clang-format with the following changes: 1. Modify the column limit to 96 to provide some slack so we can make code more readable and don't have to be constrained to 80 characters always. This is the cause of most of the errors reported by the tool and should cleanup the reports so we can actually focus on the real remaining issues. 2. Don't align expressions after linebreaks to ensure that we instead rely on 'ContinuationIndentWidth'. This fix is rather small and ensures that instead of trying to align wrapped expressions, we follow the indentation width. 3. Align the macro definitions. This is something we follow to keep the macros readable. I will still keep monitoring the jobs from time to time to ensure we can fine tune more as needed, if someone see's something odd, do keep me in the loop. Thanks Changes over the previous version: 1. Change the column limit from 0 to 96, this way we still have a column limit but provide some slack. 2. Add an example for the third commit. Karthik Nayak (3): clang-format: change column limit to 96 characters clang-format: don't align expressions after linebreaks clang-format: align consecutive macro definitions .clang-format | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) Range-diff against v1: 1: 34cd0c29f6 ! 1: e22ffbe0f6 clang-format: don't enforce the column limit @@ Metadata Author: Karthik Nayak <karthik.188@xxxxxxxxx> ## Commit message ## - clang-format: don't enforce the column limit + clang-format: change column limit to 96 characters The current value for the column limit is set to 80. While this is as expected, we often prefer readability over this strict limit. This means it is common to find code which extends over 80 characters. So let's - change the column limit to be 0 instead. This ensures that the formatter - doesn't complain about code strictly not following the column limit. + change the column limit to be 96 instead. This provides some slack so we + can ensure readability takes preference over the 80 character hard + limit. Signed-off-by: Karthik Nayak <karthik.188@xxxxxxxxx> @@ .clang-format: UseTab: Always ContinuationIndentWidth: 8 -ColumnLimit: 80 + -+# While we recommend keeping column limit to 80, we don't want to -+# enforce it as we generally are more lenient with this rule and -+# prefer to prioritize readability. -+ColumnLimit: 0 ++# While we recommend keeping column limit to 80, we want to also provide ++# some slack to maintain readability. ++ColumnLimit: 96 # C Language specifics Language: Cpp 2: 3557012fea = 2: b55d5d2c14 clang-format: don't align expressions after linebreaks 3: ad023a6cf6 ! 3: 6ebcd2690e clang-format: align consecutive macro definitions @@ Metadata ## Commit message ## clang-format: align consecutive macro definitions - We generally align consecutive macro definitions for better readability. + We generally align consecutive macro definitions for better readability: + + #define OUTPUT_ANNOTATE_COMPAT (1U<<0) + #define OUTPUT_LONG_OBJECT_NAME (1U<<1) + #define OUTPUT_RAW_TIMESTAMP (1U<<2) + #define OUTPUT_PORCELAIN (1U<<3) + + over + + #define OUTPUT_ANNOTATE_COMPAT (1U<<0) + #define OUTPUT_LONG_OBJECT_NAME (1U<<1) + #define OUTPUT_RAW_TIMESTAMP (1U<<2) + #define OUTPUT_PORCELAIN (1U<<3) + So let's add the rule in clang-format to follow this. Signed-off-by: Karthik Nayak <karthik.188@xxxxxxxxx> -- 2.47.0