aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGeorge Melikov <[email protected]>2020-08-12 20:45:50 +0300
committerBrian Behlendorf <[email protected]>2020-08-13 14:58:53 -0700
commit42d4a8e5feadd2e9d95687656701c3dcca4fb23a (patch)
tree42b6c4f81b6e01d0fc8c5a52cd397fda2db14ded /scripts
parent2925ed6c702eeafe81d77fe7e39aef091ce8f16f (diff)
cstyle.pl: echo commands for github workflow
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: George Melikov <[email protected]> Closes #10705
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/cstyle.pl13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/cstyle.pl b/scripts/cstyle.pl
index 00b33dddf..d19718ecf 100755
--- a/scripts/cstyle.pl
+++ b/scripts/cstyle.pl
@@ -58,8 +58,9 @@ use Getopt::Std;
use strict;
my $usage =
-"usage: cstyle [-chpvCP] [-o constructs] file ...
+"usage: cstyle [-cghpvCP] [-o constructs] file ...
-c check continuation indentation inside functions
+ -g print github actions' workflow commands
-h perform heuristic checks that are sometimes wrong
-p perform some of the more picky checks
-v verbose
@@ -73,12 +74,13 @@ my $usage =
my %opts;
-if (!getopts("cho:pvCP", \%opts)) {
+if (!getopts("cgho:pvCP", \%opts)) {
print $usage;
exit 2;
}
my $check_continuation = $opts{'c'};
+my $github_workflow = $opts{'g'} || $ENV{'CI'};
my $heuristic = $opts{'h'};
my $picky = $opts{'p'};
my $verbose = $opts{'v'};
@@ -197,7 +199,10 @@ sub err($) {
printf $fmt, $filename, $., $error, $line;
} else {
printf $fmt, $filename, $., $error;
- }
+ }
+ if ($github_workflow) {
+ printf "::error file=%s,line=%s::%s\n", $filename, $., $error;
+ }
$err_stat = 1;
}
}
@@ -415,7 +420,7 @@ line: while (<$filehandle>) {
$prev = $line;
next line;
} elsif ($picky && ! (/^\t/ && $function_header_full_indent != 0)) {
-
+
err("continuation line should be indented by 4 spaces");
}
}