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>
This commit is contained in:
parent
eb7b589f8f
commit
57f1162363
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue