Skip to content

Commit

Permalink
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;
  • Loading branch information
casimiro committed May 9, 2024
1 parent 8fb4bdd commit db8adea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions util/morestyle.pl
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@
$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.";
Expand Down

0 comments on commit db8adea

Please sign in to comment.