master
1#!/usr/bin/env perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
10#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.se/docs/copyright.html.
14#
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22# SPDX-License-Identifier: curl
23#
24###########################################################################
26use strict;
27use warnings;
29my $max_column = 79;
30my $indent = 2;
32my $warnings = 0;
33my $swarnings = 0;
34my $errors = 0;
35my $serrors = 0;
36my $suppressed; # skipped problems
37my $file;
38my $dir = ".";
39my $wlist = "";
40my @alist;
41my $windows_os = $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys';
42my $verbose = 0;
43my %skiplist;
45my %ignore;
46my %ignore_set;
47my %ignore_used;
48my @ignore_line;
50my %banfunc = (
51 "_access" => 1,
52 "_fstati64" => 1,
53 "_lseeki64" => 1,
54 "_mbscat" => 1,
55 "_mbsncat" => 1,
56 "_open" => 1,
57 "_tcscat" => 1,
58 "_tcsdup" => 1,
59 "_tcsncat" => 1,
60 "_tcsncpy" => 1,
61 "_waccess" => 1,
62 "_wcscat" => 1,
63 "_wcsdup" => 1,
64 "_wcsncat" => 1,
65 "_wfopen" => 1,
66 "_wfreopen" => 1,
67 "_wopen" => 1,
68 "abort" => 1,
69 "accept" => 1,
70 "accept4" => 1,
71 "access" => 1,
72 "aprintf" => 1,
73 "assert" => 1,
74 "atoi" => 1,
75 "atol" => 1,
76 "calloc" => 1,
77 "close" => 1,
78 "CreateFile" => 1,
79 "CreateFileA" => 1,
80 "CreateFileW" => 1,
81 "fclose" => 1,
82 "fdopen" => 1,
83 "fopen" => 1,
84 "fprintf" => 1,
85 "free" => 1,
86 "freeaddrinfo" => 1,
87 "freopen" => 1,
88 "fstat" => 1,
89 "getaddrinfo" => 1,
90 "gets" => 1,
91 "gmtime" => 1,
92 "inet_ntop" => 1,
93 "inet_pton" => 1,
94 "llseek" => 1,
95 "LoadLibrary" => 1,
96 "LoadLibraryA" => 1,
97 "LoadLibraryEx" => 1,
98 "LoadLibraryExA" => 1,
99 "LoadLibraryExW" => 1,
100 "LoadLibraryW" => 1,
101 "localtime" => 1,
102 "lseek" => 1,
103 "malloc" => 1,
104 "mbstowcs" => 1,
105 "MoveFileEx" => 1,
106 "MoveFileExA" => 1,
107 "MoveFileExW" => 1,
108 "msnprintf" => 1,
109 "mvsnprintf" => 1,
110 "open" => 1,
111 "printf" => 1,
112 "realloc" => 1,
113 "recv" => 1,
114 "rename" => 1,
115 "send" => 1,
116 "snprintf" => 1,
117 "socket" => 1,
118 "socketpair" => 1,
119 "sprintf" => 1,
120 "sscanf" => 1,
121 "stat" => 1,
122 "strcat" => 1,
123 "strcpy" => 1,
124 "strdup" => 1,
125 "strerror" => 1,
126 "strncat" => 1,
127 "strncpy" => 1,
128 "strtok_r" => 1,
129 "strtok" => 1,
130 "strtol" => 1,
131 "strtoul" => 1,
132 "vaprintf" => 1,
133 "vfprintf" => 1,
134 "vprintf" => 1,
135 "vsnprintf" => 1,
136 "vsprintf" => 1,
137 "wcscpy" => 1,
138 "wcsdup" => 1,
139 "wcsncpy" => 1,
140 "wcstombs" => 1,
141 "WSASocket" => 1,
142 "WSASocketA" => 1,
143 "WSASocketW" => 1,
144 );
146my %warnings_extended = (
147 'COPYRIGHTYEAR' => 'copyright year incorrect',
148 'PRINTFZ' => '%zd, %zu or %zx printf mask detected',
149 'STDERR' => 'stderr detected',
150 );
152my %warnings = (
153 'ASSIGNWITHINCONDITION' => 'assignment within conditional expression',
154 'ASTERISKNOSPACE' => 'pointer declared without space before asterisk',
155 'ASTERISKSPACE' => 'pointer declared with space after asterisk',
156 'BADCOMMAND' => 'bad !checksrc! instruction',
157 'BANNEDFUNC' => 'a banned function was used',
158 'BANNEDPREPROC' => 'a banned symbol was used on a preprocessor line',
159 'BRACEELSE' => '} else on the same line',
160 'BRACEPOS' => 'wrong position for an open brace',
161 'BRACEWHILE' => 'A single space between open brace and while',
162 'CLOSEBRACE' => 'close brace indent level vs line above is off',
163 'COMMANOSPACE' => 'comma without following space',
164 'COMMENTNOSPACEEND' => 'no space before */',
165 'COMMENTNOSPACESTART' => 'no space following /*',
166 'COPYRIGHT' => 'file missing a copyright statement',
167 'CPPCOMMENTS' => '// comment detected',
168 'CPPSPACE' => 'space before preprocessor hash',
169 'DOBRACE' => 'A single space between do and open brace',
170 'EMPTYLINEBRACE' => 'Empty line before the open brace',
171 'EQUALSNOSPACE' => 'equals sign without following space',
172 'EQUALSNULL' => 'if/while comparison with == NULL',
173 'EQUALSPACE' => 'equals sign with too many spaces following',
174 'ERRNOVAR' => 'use of bare errno define',
175 'EXCLAMATIONSPACE' => 'Whitespace after exclamation mark in expression',
176 'FIXME' => 'FIXME or TODO comment',
177 'FOPENMODE' => 'fopen needs a macro for the mode string',
178 'IFDEFSINGLE' => 'use ifdef/ifndef for single macro checks',
179 'INCLUDEDUP' => 'same file is included again',
180 'INDENTATION' => 'wrong start column for code',
181 'LONGLINE' => "Line longer than $max_column",
182 'MULTISPACE' => 'multiple spaces used when not suitable',
183 'NOSPACEAND' => 'missing space around Logical AND operator',
184 'NOSPACEC' => 'missing space around ternary colon operator',
185 'NOSPACEEQUALS' => 'equals sign without preceding space',
186 'NOSPACEPLUS' => 'no space before plus sign',
187 'NOSPACEQ' => 'missing space around ternary question mark operator',
188 'NOSPACETHAN' => 'missing space around less or greater than',
189 'NOTEQUALSZERO' => 'if/while comparison with != 0',
190 'ONELINECONDITION' => 'conditional block on the same line as the if()',
191 'OPENCOMMENT' => 'file ended with a /* comment still "open"',
192 'PARENBRACE' => '){ without sufficient space',
193 'PLUSNOSPACE' => 'no space after plus sign',
194 'RETURNNOSPACE' => 'return without space',
195 'RETURNPAREN' => 'return with paren',
196 'SEMINOSPACE' => 'semicolon without following space',
197 'SIZEOFNOPAREN' => 'use of sizeof without parentheses',
198 'SPACEAFTERPAREN' => 'space after open parenthesis',
199 'SPACEBEFORECLOSE' => 'space before a close parenthesis',
200 'SPACEBEFORECOMMA' => 'space before a comma',
201 'SPACEBEFORELABEL' => 'labels not at the start of the line',
202 'SPACEBEFOREPAREN' => 'space before an open parenthesis',
203 'SPACESEMICOLON' => 'space before semicolon',
204 'SPACESWITCHCOLON' => 'space before colon of switch label',
205 'TABS' => 'TAB characters not allowed',
206 'TRAILINGSPACE' => 'Trailing whitespace on the line',
207 'TYPEDEFSTRUCT' => 'typedefed struct',
208 'UNUSEDIGNORE' => 'a warning ignore was not used',
209 'USESAFEFREE' => 'replace curlx_free() + NULL assignment with curlx_safefree()',
210 'VOIDEXCL' => '(void)! is not something we like',
211 );
213sub readskiplist {
214 open(my $W, '<', "$dir/checksrc.skip") or return;
215 my @all = <$W>;
216 for(@all) {
217 $windows_os ? $_ =~ s/\r?\n$// : chomp;
218 $skiplist{$_} = 1;
219 }
220 close($W);
221}
223# Reads the .checksrc in $dir for any extended warnings to enable locally.
224# Currently there is no support for disabling warnings from the standard set,
225# and since that is already handled via !checksrc! commands there is probably
226# little use to add it.
227sub readlocalfile {
228 my ($file) = @_;
229 my $i = 0;
230 my $rcfile;
232 if(($dir eq ".") && $file =~ /\//) {
233 my $ldir;
234 if($file =~ /(.*)\//) {
235 $ldir = $1;
236 open($rcfile, "<", "$dir/$ldir/.checksrc") or return;
237 }
238 }
239 else {
240 open($rcfile, "<", "$dir/.checksrc") or return;
241 }
243 while(<$rcfile>) {
244 $windows_os ? $_ =~ s/\r?\n$// : chomp;
245 $i++;
247 # Lines starting with '#' are considered comments
248 if(/^\s*(#.*)/) {
249 next;
250 }
251 # Skip empty lines
252 elsif($_ eq '') {
253 next;
254 }
255 elsif(/^enable ([A-Z]+)$/) {
256 if(!defined($warnings_extended{$1})) {
257 print STDERR "invalid warning specified in .checksrc: \"$1\"\n";
258 next;
259 }
260 $warnings{$1} = $warnings_extended{$1};
261 }
262 elsif(/^disable ([A-Z]+)$/) {
263 if(!defined($warnings{$1})) {
264 print STDERR "invalid warning specified in .checksrc: \"$1\"\n";
265 next;
266 }
267 # Accept-list
268 push @alist, $1;
269 }
270 elsif(/^banfunc ([^ ]*)/) {
271 $banfunc{$1} = $1;
272 }
273 elsif(/^allowfunc ([^ ]*)/) {
274 undef $banfunc{$1};
275 }
276 else {
277 die "Invalid format in $dir/.checksrc on line $i: $_\n";
278 }
279 }
280 close($rcfile);
281}
283sub checkwarn {
284 my ($name, $num, $col, $file, $line, $msg, $error) = @_;
286 my $w = $error ? "error" : "warning";
287 my $nowarn = 0;
289 #if(!$warnings{$name}) {
290 # print STDERR "Dev! there is no description for $name!\n";
291 #}
293 # checksrc.skip
294 if($skiplist{$line}) {
295 $nowarn = 1;
296 }
297 # !checksrc! controlled
298 elsif($ignore{$name}) {
299 $ignore{$name}--;
300 $ignore_used{$name}++;
301 $nowarn = 1;
302 if(!$ignore{$name}) {
303 # reached zero, enable again
304 enable_warn($name, $num, $file, $line);
305 }
306 }
308 if($nowarn) {
309 $suppressed++;
310 if($error) {
311 $serrors++;
312 }
313 else {
314 $swarnings++;
315 }
316 return;
317 }
319 if($error) {
320 $errors++;
321 }
322 else {
323 $warnings++;
324 }
326 $col++;
327 print "$file:$num:$col: $w: $msg ($name)\n";
328 print " $line\n";
330 if($col < 80) {
331 my $pref = (' ' x $col);
332 print "${pref}^\n";
333 }
334}
336$file = shift @ARGV;
338while(defined $file) {
340 if($file =~ /^-D(.*)/) {
341 $dir = $1;
342 $file = shift @ARGV;
343 next;
344 }
345 elsif($file =~ /^-W(.*)/) {
346 $wlist .= " $1 ";
347 $file = shift @ARGV;
348 next;
349 }
350 elsif($file =~ /^-b(.*)/) {
351 $banfunc{$1} = $1;
352 # print STDERR "ban use of \"$1\"\n";
353 $file = shift @ARGV;
354 next;
355 }
356 elsif($file =~ /^-a(.*)/) {
357 undef $banfunc{$1};
358 $file = shift @ARGV;
359 next;
360 }
361 elsif($file =~ /^-A(.+)/) {
362 push @alist, $1;
363 $file = shift @ARGV;
364 next;
365 }
366 elsif($file =~ /^-i([1-9])/) {
367 $indent = $1 + 0;
368 $file = shift @ARGV;
369 next;
370 }
371 elsif($file =~ /^-m([0-9]+)/) {
372 $max_column = $1 + 0;
373 $file = shift @ARGV;
374 next;
375 }
376 elsif($file =~ /^-v/) {
377 $verbose = 1;
378 $file = shift @ARGV;
379 next;
380 }
381 elsif($file =~ /^(-h|--help)/) {
382 undef $file;
383 last;
384 }
386 last;
387}
389if(!$file) {
390 print "checksrc.pl [option] <file1> [file2] ...\n";
391 print " Options:\n";
392 print " -A[rule] Accept this violation, can be used multiple times\n";
393 print " -a[func] Allow use of this function\n";
394 print " -b[func] Ban use of this function\n";
395 print " -D[DIR] Directory to prepend filenames\n";
396 print " -h Show help output\n";
397 print " -W[file] Skip the given file - ignore all its flaws\n";
398 print " -i<n> Indent spaces. Default: 2\n";
399 print " -m<n> Maximum line length. Default: 79\n";
400 print " -v Verbose\n";
401 print "\nDetects and warns for these problems:\n";
402 my @allw = keys %warnings;
403 push @allw, keys %warnings_extended;
404 for my $w (sort @allw) {
405 if($warnings{$w}) {
406 printf (" %-18s: %s\n", $w, $warnings{$w});
407 }
408 else {
409 printf (" %-18s: %s[*]\n", $w, $warnings_extended{$w});
410 }
411 }
412 print " [*] = disabled by default\n";
414 print "\nDetects and bans use of these functions:\n";
415 for my $f (sort keys %banfunc) {
416 printf (" %-18s\n", $f);
417 }
418 exit;
419}
421readskiplist();
422readlocalfile($file);
424do {
425 if($wlist !~ / $file /) {
426 my $fullname = $file;
427 $fullname = "$dir/$file" if($fullname !~ /^\.?\.?\//);
428 scanfile($fullname);
429 }
430 $file = shift @ARGV;
432} while($file);
434sub accept_violations {
435 for my $r (@alist) {
436 if(!$warnings{$r}) {
437 print "'$r' is not a warning to accept!\n";
438 exit;
439 }
440 $ignore{$r} = 999999;
441 $ignore_used{$r} = 0;
442 }
443}
445sub checksrc_clear {
446 undef %ignore;
447 undef %ignore_set;
448 undef @ignore_line;
449}
451sub checksrc_endoffile {
452 my ($file) = @_;
453 for(keys %ignore_set) {
454 if($ignore_set{$_} && !$ignore_used{$_}) {
455 checkwarn("UNUSEDIGNORE", $ignore_set{$_},
456 length($_) + 11, $file,
457 $ignore_line[$ignore_set{$_}],
458 "Unused ignore: $_");
459 }
460 }
461}
463sub enable_warn {
464 my ($what, $line, $file, $l) = @_;
466 # switch it back on, but warn if not triggered!
467 if(!$ignore_used{$what}) {
468 checkwarn("UNUSEDIGNORE",
469 $line, length($what) + 11, $file, $l,
470 "No warning was inhibited!");
471 }
472 $ignore_set{$what} = 0;
473 $ignore_used{$what} = 0;
474 $ignore{$what} = 0;
475}
477sub checksrc {
478 my ($cmd, $line, $file, $l) = @_;
479 if($cmd =~ / *([^ ]*) *(.*)/) {
480 my ($enable, $what) = ($1, $2);
481 $what =~ s: *\*/$::; # cut off end of C comment
482 # print "ENABLE $enable WHAT $what\n";
483 if($enable eq "disable") {
484 my ($warn, $scope) = ($1, $2);
485 if($what =~ /([^ ]*) +(.*)/) {
486 ($warn, $scope) = ($1, $2);
487 }
488 else {
489 $warn = $what;
490 $scope = 1;
491 }
492 # print "IGNORE $warn for SCOPE $scope\n";
493 if($scope eq "all") {
494 $scope = 999999;
495 }
497 # Comparing for a literal zero rather than the scalar value zero
498 # covers the case where $scope contains the ending '*' from the
499 # comment. If we use a scalar comparison (==) we induce warnings
500 # on non-scalar contents.
501 if($scope eq "0") {
502 checkwarn("BADCOMMAND",
503 $line, 0, $file, $l,
504 "Disable zero not supported, did you mean to enable?");
505 }
506 elsif($ignore_set{$warn}) {
507 checkwarn("BADCOMMAND",
508 $line, 0, $file, $l,
509 "$warn already disabled from line $ignore_set{$warn}");
510 }
511 else {
512 $ignore{$warn} = $scope;
513 $ignore_set{$warn} = $line;
514 $ignore_line[$line] = $l;
515 }
516 }
517 elsif($enable eq "enable") {
518 enable_warn($what, $line, $file, $l);
519 }
520 else {
521 checkwarn("BADCOMMAND",
522 $line, 0, $file, $l,
523 "Illegal !checksrc! command");
524 }
525 }
526}
528sub nostrings {
529 my ($str) = @_;
530 $str =~ s/\".*\"//g;
531 return $str;
532}
534sub scanfile {
535 my ($file) = @_;
537 my $line = 1;
538 my $prevl = "";
539 my $prevpl = "";
540 my $l = "";
541 my $prep = 0;
542 my $prevp = 0;
543 my $prevfreeindent = "";
544 my $prevfreevar = "";
546 if($verbose) {
547 printf "Checking file: $file\n";
548 }
550 open(my $R, '<', $file) or die "failed to open $file";
552 my $incomment = 0;
553 my @copyright = ();
554 my %includes;
555 checksrc_clear(); # for file based ignores
556 accept_violations();
558 while(<$R>) {
559 $windows_os ? $_ =~ s/\r?\n$// : chomp;
560 my $l = $_;
561 my $ol = $l; # keep the unmodified line for error reporting
562 my $column = 0;
564 # check for !checksrc! commands
565 if($l =~ /\!checksrc\! (.*)/) {
566 my $cmd = $1;
567 checksrc($cmd, $line, $file, $l);
568 }
570 if($l =~ /^#line (\d+) \"([^\"]*)\"/) {
571 # a #line instruction
572 $file = $2;
573 $line = $1;
574 next;
575 }
577 # check for a copyright statement and save the years
578 if($l =~ /\* +copyright .* (\d\d\d\d|)/i) {
579 my $count = 0;
580 while($l =~ /([\d]{4})/g) {
581 push @copyright, {
582 year => $1,
583 line => $line,
584 col => index($l, $1),
585 code => $l
586 };
587 $count++;
588 }
589 if(!$count) {
590 # year-less
591 push @copyright, {
592 year => -1,
593 line => $line,
594 col => index($l, $1),
595 code => $l
596 };
597 }
598 }
600 # detect long lines
601 if(length($l) > $max_column && $l !~ / https:\/\//) {
602 checkwarn("LONGLINE", $line, length($l), $file, $l,
603 "Longer than $max_column columns");
604 }
605 # detect TAB characters
606 if($l =~ /^(.*)\t/) {
607 checkwarn("TABS",
608 $line, length($1), $file, $l, "Contains TAB character", 1);
609 }
610 # detect trailing whitespace
611 if($l =~ /^(.*)[ \t]+\z/) {
612 checkwarn("TRAILINGSPACE",
613 $line, length($1), $file, $l, "Trailing whitespace");
614 }
616 # no space after comment start
617 if($l =~ /^(.*)\/\*\w/) {
618 checkwarn("COMMENTNOSPACESTART",
619 $line, length($1) + 2, $file, $l,
620 "Missing space after comment start");
621 }
622 # no space at comment end
623 if($l =~ /^(.*)\w\*\//) {
624 checkwarn("COMMENTNOSPACEEND",
625 $line, length($1) + 1, $file, $l,
626 "Missing space before comment end");
627 }
629 if($l =~ /(.*)(FIXME|TODO)/) {
630 checkwarn("FIXME",
631 $line, length($1), $file, $l,
632 "Avoid $2 comments. Add to documentation instead");
633 }
634 # ------------------------------------------------------------
635 # Above this marker, the checks were done on lines *including*
636 # comments
637 # ------------------------------------------------------------
639 # strip off C89 comments
641 comment:
642 if(!$incomment) {
643 if($l =~ s/\/\*.*\*\// /g) {
644 # full /* comments */ were removed!
645 }
646 if($l =~ s/\/\*.*//) {
647 # start of /* comment was removed
648 $incomment = 1;
649 }
650 }
651 else {
652 if($l =~ s/.*\*\///) {
653 # end of comment */ was removed
654 $incomment = 0;
655 goto comment;
656 }
657 else {
658 # still within a comment
659 $l = "";
660 }
661 }
663 # ------------------------------------------------------------
664 # Below this marker, the checks were done on lines *without*
665 # comments
666 # ------------------------------------------------------------
668 # prev line was a preprocessor **and** ended with a backslash
669 if($prep && ($prevpl =~ /\\ *\z/)) {
670 # this is still a preprocessor line
671 $prep = 1;
672 goto preproc;
673 }
674 $prep = 0;
676 # crude attempt to detect // comments without too many false
677 # positives
678 if($l =~ /^(([^"\*]*)[^:"]|)\/\//) {
679 checkwarn("CPPCOMMENTS",
680 $line, length($1), $file, $l, "\/\/ comment");
681 }
683 if($l =~ /^(\s*#\s*if\s+!?\s*defined\()[a-zA-Z0-9_]+\)$/) {
684 checkwarn("IFDEFSINGLE",
685 $line, length($1), $file, $l, "use ifdef/ifndef for single macro checks");
686 }
688 if($l =~ /^(\#\s*include\s+)([\">].*[>}"])/) {
689 my ($pre, $path) = ($1, $2);
690 if($includes{$path}) {
691 checkwarn("INCLUDEDUP",
692 $line, length($1), $file, $l, "duplicated include");
693 }
694 $includes{$path} = $l;
695 }
697 # detect leading space before the hash
698 if($l =~ /^([ \t]+)\#/) {
699 checkwarn("CPPSPACE",
700 $line, 0, $file, $l, "space before preprocessor hash");
701 }
702 # detect and strip preprocessor directives
703 if($l =~ /^[ \t]*\#/) {
704 # preprocessor line
705 $prep = 1;
706 goto preproc;
707 }
709 my $nostr = nostrings($l);
710 # check spaces after for/if/while/function call
711 if($nostr =~ /^(.*)(for|if|while|switch| ([a-zA-Z0-9_]+)) \((.)/) {
712 my ($leading, $word, $extra, $first) = ($1, $2, $3, $4);
713 if($1 =~ / *\#/) {
714 # this is a #if, treat it differently
715 }
716 elsif(defined $3 && $3 eq "return") {
717 # return must have a space
718 }
719 elsif(defined $3 && $3 eq "case") {
720 # case must have a space
721 }
722 elsif(($first eq "*") && ($word !~ /(for|if|while|switch)/)) {
723 # A "(*" beginning makes the space OK because it wants to
724 # allow function pointer declared
725 }
726 elsif($1 =~ / *typedef/) {
727 # typedefs can use space-paren
728 }
729 else {
730 checkwarn("SPACEBEFOREPAREN", $line, length($leading)+length($word), $file, $l,
731 "$word with space");
732 }
733 }
734 # check for '== NULL' in if/while conditions but not if the thing on
735 # the left of it is a function call
736 if($nostr =~ /^(.*)(if|while)(\(.*?)([!=]= NULL|NULL [!=]=)/) {
737 checkwarn("EQUALSNULL", $line,
738 length($1) + length($2) + length($3),
739 $file, $l, "we prefer !variable instead of \"== NULL\" comparisons");
740 }
742 # check for '!= 0' in if/while conditions but not if the thing on
743 # the left of it is a function call
744 if($nostr =~ /^(.*)(if|while)(\(.*[^)]) != 0[^x]/) {
745 checkwarn("NOTEQUALSZERO", $line,
746 length($1) + length($2) + length($3),
747 $file, $l, "we prefer if(rc) instead of \"rc != 0\" comparisons");
748 }
750 # check spaces in 'do {'
751 if($nostr =~ /^( *)do( *)\{/ && length($2) != 1) {
752 checkwarn("DOBRACE", $line, length($1) + 2, $file, $l, "one space after do before brace");
753 }
754 # check spaces in 'do {'
755 elsif($nostr =~ /^( *)\}( *)while/ && length($2) != 1) {
756 checkwarn("BRACEWHILE", $line, length($1) + 2, $file, $l, "one space between brace and while");
757 }
758 if($nostr =~ /^((.*\s)(if) *\()(.*)\)(.*)/) {
759 my $pos = length($1);
760 my $postparen = $5;
761 my $cond = $4;
762 if($cond =~ / = /) {
763 checkwarn("ASSIGNWITHINCONDITION",
764 $line, $pos + 1, $file, $l,
765 "assignment within conditional expression");
766 }
767 my $temp = $cond;
768 $temp =~ s/\(//g; # remove open parens
769 my $openc = length($cond) - length($temp);
771 $temp = $cond;
772 $temp =~ s/\)//g; # remove close parens
773 my $closec = length($cond) - length($temp);
774 my $even = $openc == $closec;
776 if($l =~ / *\#/) {
777 # this is a #if, treat it differently
778 }
779 elsif($even && $postparen &&
780 ($postparen !~ /^ *$/) && ($postparen !~ /^ *[,{&|\\]+/)) {
781 checkwarn("ONELINECONDITION",
782 $line, length($l)-length($postparen), $file, $l,
783 "conditional block on the same line");
784 }
785 }
786 # check spaces after open parentheses
787 if($l =~ /^(.*[a-z])\( /i) {
788 checkwarn("SPACEAFTERPAREN",
789 $line, length($1)+1, $file, $l,
790 "space after open parenthesis");
791 }
793 # check spaces before Logical AND operator
794 if($nostr =~ /^(.*)\w&&/i) {
795 checkwarn("NOSPACEAND",
796 $line, length($1)+1, $file, $l,
797 "missing space before Logical AND");
798 }
800 # check spaces after Logical AND operator
801 if($nostr =~ /^(.*&&)\w/i) {
802 checkwarn("NOSPACEAND",
803 $line, length($1), $file, $l,
804 "missing space after Logical AND");
805 }
807 # check spaces before colon
808 if($nostr =~ /^(.*[^']\?[^'].*)(\w|\)|\]|')\:/i) {
809 my $m = $1;
810 my $e = $nostr;
811 $e =~ s/'(.)':'(.)'/$1:$2/g; # eliminate chars quotes that surround colon
812 $e =~ s/':'//g; # ignore these
813 if($e =~ /^(.*[^']\?[^'].*)(\w|\)|\]|')\:/i) {
814 checkwarn("NOSPACEC",
815 $line, length($m)+1, $file, $l,
816 "missing space before colon");
817 }
818 }
819 # check spaces after colon
820 if($nostr =~ /^(.*[^'"]\?[^'"].*)\:(\w|\)|\]|')/i) {
821 my $m = $1;
822 my $e = $nostr;
823 $e =~ s/'(.)':'(.)'/$1:$2/g; # eliminate chars quotes that surround colon
824 $e =~ s/':'//g; # ignore these
825 if($e =~ /^(.*[^'"]\?[^'"].*)\:(\w|\)|\]|')/i) {
826 checkwarn("NOSPACEC",
827 $line, length($m)+1, $file, $l,
828 "missing space after colon");
829 }
830 }
832 # check spaces before question mark
833 if($nostr =~ /^(.*)(\w|\)|\]|')\?/i) {
834 my $m = $1;
835 my $e = $nostr;
836 $e =~ s/'?'//g; # ignore these
837 if($e =~ /^(.*)(\w|\)|\]|')\?/i) {
838 checkwarn("NOSPACEQ",
839 $line, length($m)+1, $file, $l,
840 "missing space before question mark");
841 }
842 }
843 # check spaces after question mark
844 if($nostr =~ /^(.*)\?\w/i) {
845 checkwarn("NOSPACEQ",
846 $line, length($1)+1, $file, $l,
847 "missing space after question mark");
848 }
850 # check spaces before less or greater than
851 if($nostr =~ /^(.*)(\w|\)|\])[<>]/) {
852 checkwarn("NOSPACETHAN",
853 $line, length($1)+1, $file, $l,
854 "missing space before less or greater than");
855 }
856 # check spaces after less or greater than
857 if($nostr =~ /^(.*)[^-][<>](\w|\(|\[)/) {
858 checkwarn("NOSPACETHAN",
859 $line, length($1)+1, $file, $l,
860 "missing space after less or greater than");
861 }
863 # check spaces before close parentheses, unless it was a space or a
864 # close parenthesis!
865 if($l =~ /(.*[^\) ]) \)/) {
866 checkwarn("SPACEBEFORECLOSE",
867 $line, length($1)+1, $file, $l,
868 "space before close parenthesis");
869 }
871 # check spaces before comma!
872 if($l =~ /(.*[^ ]) ,/) {
873 checkwarn("SPACEBEFORECOMMA",
874 $line, length($1)+1, $file, $l,
875 "space before comma");
876 }
878 # check for "return(" without space
879 if($l =~ /^(.*\W)return\(/) {
880 if($1 =~ / *\#/) {
881 # this is a #if, treat it differently
882 }
883 else {
884 checkwarn("RETURNNOSPACE", $line, length($1)+6, $file, $l,
885 "return without space before paren");
886 }
887 }
889 # check for "return" with parentheses around a value/name
890 if($l =~ /^(.*\W)return \(\w*\);/) {
891 checkwarn("RETURNPAREN", $line, length($1)+7, $file, $l,
892 "return with paren");
893 }
895 # check for "sizeof" without parenthesis
896 if(($l =~ /^(.*)sizeof *([ (])/) && ($2 ne "(")) {
897 if($1 =~ / *\#/) {
898 # this is a #if, treat it differently
899 }
900 else {
901 checkwarn("SIZEOFNOPAREN", $line, length($1)+6, $file, $l,
902 "sizeof without parenthesis");
903 }
904 }
906 # check for comma without space
907 if($l =~ /^(.*),[^ \n]/) {
908 my $pref = $1;
909 my $ign = 0;
910 if($pref =~ / *\#/) {
911 # this is a #if, treat it differently
912 $ign = 1;
913 }
914 elsif($pref =~ /\/\*/) {
915 # this is a comment
916 $ign = 1;
917 }
918 elsif($pref =~ /[\"\']/) {
919 $ign = 1;
920 # There is a quote here, figure out whether the comma is
921 # within a string or '' or not.
922 if($pref =~ /\"/) {
923 # within a string
924 }
925 elsif($pref =~ /\'$/) {
926 # a single letter
927 }
928 else {
929 $ign = 0;
930 }
931 }
932 if(!$ign) {
933 checkwarn("COMMANOSPACE", $line, length($pref)+1, $file, $l,
934 "comma without following space");
935 }
936 }
938 # when the line starts with a brace
939 if($l =~ /^( *)\}/) {
940 my $tlen = length($1);
941 if($prevl =~ /^( *)(.)/) {
942 my $plen = length($1);
943 my $firstc = $2;
944 # skips the check if the previous line starts with a close
945 # brace since we see the occasional legit use of that oddity
946 if(($tlen + $indent) > $plen && ($firstc ne "}")) {
947 checkwarn("CLOSEBRACE",
948 $line, $plen, $file, $prevl,
949 "Suspicious close brace indentation");
950 }
951 }
952 }
953 # check for "} else"
954 if($l =~ /^(.*)\} *else/) {
955 checkwarn("BRACEELSE",
956 $line, length($1), $file, $l, "else after closing brace on same line");
957 }
958 # check for "){"
959 if($l =~ /^(.*)\)\{/) {
960 checkwarn("PARENBRACE",
961 $line, length($1)+1, $file, $l, "missing space after close paren");
962 }
963 # check for "^{" with an empty line before it
964 if(($l =~ /^\{/) && ($prevl =~ /^[ \t]*\z/)) {
965 checkwarn("EMPTYLINEBRACE",
966 $line, 0, $file, $l, "empty line before open brace");
967 }
969 # check for space before the semicolon last in a line
970 if($l =~ /^(.*[^ ].*) ;$/) {
971 checkwarn("SPACESEMICOLON",
972 $line, length($1), $file, $ol, "no space before semicolon");
973 }
975 # check for space before the colon in a switch label
976 if($l =~ /^( *(case .+|default)) :/) {
977 checkwarn("SPACESWITCHCOLON",
978 $line, length($1), $file, $ol, "no space before colon of switch label");
979 }
981 if($prevl !~ /\?\z/ && $l =~ /^ +([A-Za-z_][A-Za-z0-9_]*):$/ && $1 ne 'default') {
982 checkwarn("SPACEBEFORELABEL",
983 $line, length($1), $file, $ol, "no space before label");
984 }
986 if($prevfreevar ne "") {
987 if(rindex($l, "$prevfreeindent$prevfreevar = NULL;", 0) == 0) {
988 checkwarn("USESAFEFREE",
989 $line, length($prevfreeindent), $file, $ol,
990 "replace curlx_free() + NULL assignment with curlx_safefree()");
991 }
992 }
993 if($l) {
994 if($l =~ /^( *)curlx_free\(([^)]+)\);/) {
995 $prevfreeindent = $1;
996 $prevfreevar = $2;
997 }
998 else {
999 $prevfreeindent = "";
1000 $prevfreevar = "";
1001 }
1002 }
1004 # scan for use of banned functions
1005 my $bl = $l;
1006 again:
1007 if((($l =~ /^(.*?\W)(\w+)(\s*\()/x) && $banfunc{$2}) ||
1008 (($l =~ /^(.*?\()(\w+)(\s*\()/x) && $banfunc{$2})) {
1009 my $bad = $2;
1010 my $prefix = $1;
1011 my $suff = $3;
1012 if($prefix !~ /(->|\.)$/) {
1013 checkwarn("BANNEDFUNC",
1014 $line, length($prefix), $file, $ol,
1015 "use of $bad is banned");
1016 }
1017 my $search = quotemeta($prefix . $bad . $suff);
1018 my $replace = $prefix . 'x' x (length($bad) + 1);
1019 $l =~ s/$search/$replace/;
1020 goto again;
1021 }
1022 $l = $bl; # restore to pre-bannedfunc content
1024 if($warnings{"PRINTFZ"} && $l =~ /^(.*".*)%z[dux].*"/) {
1025 # %z format support is missing from VS2013 and earlier CRT printf,
1026 # so directories where we call printf functions may ban %z.
1027 checkwarn("PRINTFZ",
1028 $line, length($1), $file, $ol,
1029 "use of %zd/%zu/%zx is banned (use %ld/%lu/%lx with cast instead)");
1030 }
1032 if($warnings{"STDERR"}) {
1033 # scan for use of banned stderr. This is not a BANNEDFUNC to
1034 # allow for individual enable/disable of this warning.
1035 if($l =~ /^([^\"-]*\W)(stderr)[^\"_]/x) {
1036 if($1 !~ /^ *\#/) {
1037 # skip preprocessor lines
1038 checkwarn("STDERR",
1039 $line, length($1), $file, $ol,
1040 "use of $2 is banned (use tool_stderr instead)");
1041 }
1042 }
1043 }
1045 # scan for use of non-binary fopen without the macro
1046 if($l =~ /^(.*\W)(curlx_fopen|CURLX_FOPEN_LOW|curlx_freopen|CURLX_FREOPEN_LOW)\s*\([^,]*, *\"([^"]*)/) {
1047 my $mode = $3;
1048 if($mode !~ /b/) {
1049 checkwarn("FOPENMODE",
1050 $line, length($1), $file, $ol,
1051 "use of non-binary fopen without FOPEN_* macro: $mode");
1052 }
1053 }
1055 # check for open brace first on line but not first column only alert
1056 # if previous line ended with a close paren and it was not a cpp line
1057 if(($prevl =~ /\)\z/) && ($l =~ /^( +)\{/) && !$prevp) {
1058 checkwarn("BRACEPOS",
1059 $line, length($1), $file, $ol, "badly placed open brace");
1060 }
1062 # if the previous line starts with if/while/for AND ends with an open
1063 # brace, or an else statement, check that this line is indented $indent
1064 # more steps, if not a cpp line
1065 if(!$prevp && ($prevl =~ /^( *)((if|while|for)\(.*\{|else)\z/)) {
1066 my $first = length($1);
1067 # this line has some character besides spaces
1068 if($l =~ /^( *)[^ ]/) {
1069 my $second = length($1);
1070 my $expect = $first+$indent;
1071 if($expect != $second) {
1072 my $diff = $second - $first;
1073 checkwarn("INDENTATION", $line, length($1), $file, $ol,
1074 "not indented $indent steps (uses $diff)");
1075 }
1076 }
1077 }
1079 # if the previous line starts with if/while/for AND ends with a closed
1080 # parenthesis and there is an equal number of open and closed
1081 # parentheses, check that this line is indented $indent more steps, if
1082 # not a cpp line
1083 elsif(!$prevp && ($prevl =~ /^( *)(if|while|for)(\(.*\))\z/)) {
1084 my $first = length($1);
1085 my $op = $3;
1086 my $cl = $3;
1088 $op =~ s/[^(]//g;
1089 $cl =~ s/[^)]//g;
1091 if(length($op) == length($cl)) {
1092 # this line has some character besides spaces
1093 if($l =~ /^( *)[^ ]/) {
1094 my $second = length($1);
1095 my $expect = $first+$indent;
1096 if($expect != $second) {
1097 my $diff = $second - $first;
1098 checkwarn("INDENTATION", $line, length($1), $file, $ol,
1099 "not indented $indent steps (uses $diff)");
1100 }
1101 }
1102 }
1103 }
1105 # check for 'char * name'
1106 if(($l =~ /(^.*(char|int|long|void|CURL|CURLM|CURLMsg|[cC]url_[A-Za-z_]+|struct [a-zA-Z_]+) *(\*+)) (\w+)/) && ($4 !~ /^(const|volatile)$/)) {
1107 checkwarn("ASTERISKSPACE",
1108 $line, length($1), $file, $ol,
1109 "space after declarative asterisk");
1110 }
1111 # check for 'char*'
1112 if(($l =~ /(^.*(char|int|long|void|curl_slist|CURL|CURLM|CURLMsg|curl_httppost|sockaddr_in|FILE)\*)/)) {
1113 checkwarn("ASTERISKNOSPACE",
1114 $line, length($1)-1, $file, $ol,
1115 "no space before asterisk");
1116 }
1118 # check for 'void func() {', but avoid false positives by requiring
1119 # both an open and closed parentheses before the open brace
1120 if($l =~ /^((\w).*)\{\z/) {
1121 my $k = $1;
1122 $k =~ s/const *//;
1123 $k =~ s/static *//;
1124 if($k =~ /\(.*\)/) {
1125 checkwarn("BRACEPOS",
1126 $line, length($l)-1, $file, $ol,
1127 "wrongly placed open brace");
1128 }
1129 }
1131 # check for equals sign without spaces next to it
1132 if($nostr =~ /(.*)\=[a-z0-9]/i) {
1133 checkwarn("EQUALSNOSPACE",
1134 $line, length($1)+1, $file, $ol,
1135 "no space after equals sign");
1136 }
1137 # check for equals sign without spaces before it
1138 elsif($nostr =~ /(.*)[a-z0-9]\=/i) {
1139 checkwarn("NOSPACEEQUALS",
1140 $line, length($1)+1, $file, $ol,
1141 "no space before equals sign");
1142 }
1143 # check for equals sign with more than one space after it
1144 elsif($l =~ /(.*)[a-z0-9] \= /i) {
1145 checkwarn("EQUALSPACE",
1146 $line, length($1)+3, $file, $ol,
1147 "more than one space after equals sign");
1148 }
1150 # check for plus signs without spaces next to it
1151 if($nostr =~ /(.*)[^+]\+[a-z0-9]/i) {
1152 checkwarn("PLUSNOSPACE",
1153 $line, length($1)+1, $file, $ol,
1154 "no space after plus sign");
1155 }
1156 # check for plus sign without spaces before it
1157 elsif($nostr =~ /(.*)[a-z0-9]\+[^+]/i) {
1158 checkwarn("NOSPACEPLUS",
1159 $line, length($1)+1, $file, $ol,
1160 "no space before plus sign");
1161 }
1163 # check for semicolons without space next to it
1164 if($nostr =~ /(.*)\;[a-z0-9]/i) {
1165 checkwarn("SEMINOSPACE",
1166 $line, length($1)+1, $file, $ol,
1167 "no space after semicolon");
1168 }
1170 # typedef struct ... {
1171 if($nostr =~ /^(.*)typedef struct.*{/) {
1172 checkwarn("TYPEDEFSTRUCT",
1173 $line, length($1)+1, $file, $ol,
1174 "typedef'ed struct");
1175 }
1177 if($nostr =~ /(.*)! +(\w|\()/) {
1178 checkwarn("EXCLAMATIONSPACE",
1179 $line, length($1)+1, $file, $ol,
1180 "space after exclamation mark");
1181 }
1183 if($nostr =~ /(.*)\(void\)\!/) {
1184 checkwarn("VOIDEXCL",
1185 $line, length($1)+1, $file, $ol,
1186 "exclamation after (void) is weird");
1187 }
1189 if($nostr =~ /(.*)\b(EACCES|EADDRINUSE|EADDRNOTAVAIL|EAFNOSUPPORT|EBADF|ECONNREFUSED|ECONNRESET|EINPROGRESS|EINTR|EINVAL|EISCONN|EMSGSIZE|ENOMEM|ETIMEDOUT|EWOULDBLOCK)\b/) {
1190 checkwarn("ERRNOVAR",
1191 $line, length($1), $file, $ol,
1192 "use of bare errno define $2, use SOCK$2");
1193 }
1195 # check for more than one consecutive space before open brace or
1196 # question mark. Skip lines containing strings since they make it hard
1197 # due to artificially getting multiple spaces
1198 if(($l eq $nostr) &&
1199 $nostr =~ /^(.*(\S)) + [{?]/i) {
1200 checkwarn("MULTISPACE",
1201 $line, length($1)+1, $file, $ol,
1202 "multiple spaces");
1203 }
1204 preproc:
1205 if($prep) {
1206 # scan for use of banned symbols on a preprocessor line
1207 if($l =~ /^(^|.*\W)
1208 (WIN32)
1209 (\W|$)
1210 /x) {
1211 checkwarn("BANNEDPREPROC",
1212 $line, length($1), $file, $ol,
1213 "use of $2 is banned from preprocessor lines" .
1214 (($2 eq "WIN32") ? ", use _WIN32 instead" : ""));
1215 }
1216 }
1217 $line++;
1218 $prevp = $prep;
1219 $prevl = $ol if(!$prep);
1220 $prevpl = $ol if($prep);
1221 }
1223 if(!scalar(@copyright)) {
1224 checkwarn("COPYRIGHT", 1, 0, $file, "", "Missing copyright statement", 1);
1225 }
1227 # COPYRIGHTYEAR is an extended warning so we must first see if it has been
1228 # enabled in .checksrc
1229 if(defined($warnings{"COPYRIGHTYEAR"})) {
1230 # The check for updated copyrightyear is overly complicated in order to
1231 # not punish current hacking for past sins. The copyright years are
1232 # right now a bit behind, so enforcing copyright year checking on all
1233 # files would cause hundreds of errors. Instead we only look at files
1234 # which are tracked in the Git repo and edited in the workdir, or
1235 # committed locally on the branch without being in upstream master.
1236 #
1237 # The simple and naive test is to check for the current year,
1238 # but updating the year even without an edit is against project policy
1239 # (and it would fail every file on January 1st).
1240 #
1241 # A rather more interesting, and correct, check would be to not test
1242 # only locally committed files but inspect all files wrt the year of
1243 # their last commit. Removing the `git rev-list origin/master..HEAD`
1244 # condition below enforces copyright year checks against the year
1245 # the file was last committed (and thus edited to some degree).
1246 my $commityear = undef;
1247 @copyright = sort {$$b{year} cmp $$a{year}} @copyright;
1249 # if the file is modified, assume commit year this year
1250 if(qx(git status -s --end-of-options "$file") =~ /^ [MARCU]/) {
1251 $commityear = (localtime(time))[5] + 1900;
1252 }
1253 else {
1254 # min-parents=1 to ignore wrong initial commit in truncated repos
1255 my $grl = qx(git rev-list --max-count=1 --min-parents=1 --timestamp --end-of-options HEAD -- "$file");
1256 if($grl) {
1257 chomp $grl;
1258 $commityear = (localtime((split(/ /, $grl))[0]))[5] + 1900;
1259 }
1260 }
1262 if(defined($commityear) && scalar(@copyright) &&
1263 $copyright[0]{year} != $commityear) {
1264 checkwarn("COPYRIGHTYEAR", $copyright[0]{line}, $copyright[0]{col},
1265 $file, $copyright[0]{code},
1266 "Copyright year out of date, should be $commityear, " .
1267 "is $copyright[0]{year}", 1);
1268 }
1269 }
1271 if($incomment) {
1272 checkwarn("OPENCOMMENT", 1, 0, $file, "", "Missing closing comment", 1);
1273 }
1275 checksrc_endoffile($file);
1277 close($R);
1278}
1280if($errors || $warnings || $verbose) {
1281 printf "checksrc: %d errors and %d warnings\n", $errors, $warnings;
1282 if($suppressed) {
1283 printf "checksrc: %d errors and %d warnings suppressed\n",
1284 $serrors,
1285 $swarnings;
1286 }
1287 if($errors || $warnings) {
1288 exit 5; # return failure
1289 }
1290}
Diagnostics4 git calls · 29 ms
CallStatusSizeTime029 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=UPDATING git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch20012 KiB · hit24 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=24 git.response.bytes=12422 git.response.cache=HIT git.response.duration_ms=24 git.fetch.wants=873f660c32c79c5e95bcbf145a65f5cc53013331 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=12422 git.pkt.payload.max=12401 git.sideband.band1.bytes=12400 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e20b303d3c7089
- Request
- 5e75fcc4…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format