summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2023-03-06 11:18:25 -0700
committerFelix Held <felix-coreboot@felixheld.de>2023-03-07 21:34:11 +0000
commit57f1162363b9e7bc59761358f7d7f81eeafe5aa9 (patch)
tree26af47f0fb30b7f38ac6fa2bbe76743ecf54c8d7 /util
parenteb7b589f8f229ecde1ba11396b70e2e8b666ff63 (diff)
util/lint: Ignore braces around single line statements
In a recent coreboot leadership meeting, the decision was made to allow (but not require) braces around single line statements if the author wishes to put them in. This patch removes the checks for single line statement blocks, while still checking for other issues in braces. Just because they're allowed now, please do not reformat the entire codebase to add them. coreboot has a policy of not making widespread changes to the entire codebase unless something actually violates the style guidelines. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I137b10889ec880959c4c1b035dc54bf8ebf32488 Reviewed-on: https://review.coreboot.org/c/coreboot/+/73515 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util')
-rwxr-xr-xutil/lint/checkpatch.pl20
1 files changed, 11 insertions, 9 deletions
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl
index a8a91e8ea1..c2efdbcd50 100755
--- a/util/lint/checkpatch.pl
+++ b/util/lint/checkpatch.pl
@@ -5631,8 +5631,9 @@ sub process {
$sum_allowed += $_;
}
if ($sum_allowed == 0) {
- WARN("BRACES",
- "braces {} are not necessary for any arm of this statement\n" . $herectx);
+ # coreboot has decided to allow braces around single line statement blocks
+ #WARN("BRACES",
+ # "braces {} are not necessary for any arm of this statement\n" . $herectx);
} elsif ($sum_allowed != $allow &&
$seen != $allow) {
CHK("BRACES",
@@ -5683,13 +5684,14 @@ sub process {
$allowed = 1;
}
}
- if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) {
- my $cnt = statement_rawlines($block);
- my $herectx = get_stat_here($linenr, $cnt, $here);
-
- WARN("BRACES",
- "braces {} are not necessary for single statement blocks\n" . $herectx);
- }
+ # coreboot has decided to allow braces around single line statement blocks
+ #if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) {
+ # my $cnt = statement_rawlines($block);
+ # my $herectx = get_stat_here($linenr, $cnt, $here);
+ #
+ # WARN("BRACES",
+ # "braces {} are not necessary for single statement blocks\n" . $herectx);
+ #}
}
# check for single line unbalanced braces