Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(morestyle) adapt spacing rule to multi-line wrapped expressions
Browse files Browse the repository at this point in the history
Accommodating the case when an expression following a variable
declaration is wrapped into multiple lines, e.g.:

size_t size = sizeof(ngx_wa_metrics_histogram_t)
              + sizeof(ngx_wa_metrics_bin_t)
              * metrics->config.max_histogram_bins;
casimiro authored and thibaultcha committed Jun 19, 2024
1 parent ae7b611 commit 8add45e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions util/morestyle.pl
Original file line number Diff line number Diff line change
@@ -93,6 +93,7 @@

if ($line =~ /\\$/) {
$comment_not_end = 1;

} else {
$one_line_comment = 1;
}
@@ -205,6 +206,9 @@
$var_line = $line;
save_var();

} elsif ($line =~ /^\s+[\+\-\*\/] [\s\w\(\)\+\-\*\/\.\-\>]/) {
# ignoring line with a portion of a wrapped expression

} elsif (!$cur_line_is_empty) {
if ($n_vars > 0 && $min_var_space - $max_var_type > 3) {
var_output "excessive spacing in variable alignment: needs 2 spaces from longest type to first name/pointer.";

0 comments on commit 8add45e

Please sign in to comment.