[sheepdog] [PATCH RFC] checkpatch: add more strict checking for block comments
MORITA Kazutaka
morita.kazutaka at gmail.com
Thu Mar 21 17:31:34 CET 2013
At Tue, 19 Mar 2013 20:09:50 +0800,
Liu Yuan wrote:
>
> +
> + if ($rawline =~ /^\+[ \t]*.*\*\/[ \t]*$/ &&
> + $rawline !~ /^\+[\S \t]*\/\*/) {
> + if ($rawline !~ /^\+[ \t]*\*\/[ \t]*$/) {
> + # case A and B
> + WARN("BLOCK_COMMENT_STYLE",
> + "[BCS] put the trailing */ on a separate line\n" . $hereprev);
> + } elsif ($prevrawline =~ /^\+[ \t]*\/\*/ ||
> + $rawlines[$linenr - 3] =~ /^\+[ \t]*\/\*/) {
> + # case C and D
> + WARN("BLOCK_COMMENT_STYLE",
> + "[BCS] don't use block comments for one liner comment\n" . $hereprev);
> + } else {
> + # case E
> + my $ln = $linenr;
> + while ($rawlines[$ln] !~ /^\+[ \t]*\/\*/) { $ln--; }
> + if ($rawlines[$ln] !~ /^\+[ \t]*\/\*[ \t]*$/) {
> + WARN("BLOCK_COMMENT_STYLE",
> + "[BCS] don't comment at first line in block comments\n" . $hereprev);
> + }
> + }
> + }
> +
I think we can use \s instad of [ \t] and use . instad of [\S \t].
Thanks,
Kazutaka
More information about the sheepdog
mailing list