Skip to content

Commit 0f2efb9

Browse files
georgiy-belyaninlocker
authored andcommitted
Error on issue reference in doc requests
Issues can be referenced after @TarantoolBot doc request. Though it will be parsed as a part of the documentation request which is wrong. This patch makes the checkpatch issue an error if there is an issue reference in the doc request body. Only the most popular constructions are handled (e.g. "closes", "part of" etc.) to avoid false-positives. Examples of handled errors: ``` @TarantoolBot document Closes #234 Follow-up #234 Follows-up: #234 EE-Issue #234 Close #999 Close #999, #123, #9900 Close http://github.com/reference/to_issue Close tarantool/tarantool-ee#234 ``` These aren't handled (referencing commits and uncommon constructions): ``` @TarantoolBot document Follows up the commit 1e94aeff Closes the issue #1234 Repairs #1234 ```
1 parent f302b42 commit 0f2efb9

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

checkpatch.pl

+34
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,36 @@ sub hash_show_words {
500500
NO_CHANGELOG
501501
)};
502502

503+
our $github_ref = qr{(https?:\/\/)?(www\.)?github\.com\b([-a-zA-Z0-9()@:%_\+.~\#?&\/=]*)};
504+
our $github_issue_ref = qr{((tarantool\/\S+)?\#[1-9][0-9]*)};
505+
506+
our $github_issue_markers = qr{(?x:
507+
Close|
508+
Closes|
509+
Part\s+of|
510+
Part-of|
511+
Issue|
512+
Follow\s+up|
513+
Follows\s+up|
514+
Follow-up|
515+
Follows-up|
516+
Needed\s+for|
517+
Needed-for|
518+
Fix|
519+
Fixes|
520+
Fixed|
521+
See|
522+
See\s+also|
523+
See-also|
524+
Related\s+to|
525+
Related-to|
526+
Related|
527+
Relates|
528+
Workaround|
529+
Implement|
530+
Implements
531+
)};
532+
503533
sub edit_distance_min {
504534
my (@arr) = @_;
505535
my $len = scalar @arr;
@@ -2723,6 +2753,10 @@ sub process {
27232753
"Please move $1 tag before doc request\n");
27242754
}
27252755
}
2756+
if ($in_commit_log && $has_doc && $line =~ /^($github_issue_markers)\s*:?\s*($github_issue_ref|$github_ref)/) {
2757+
ERROR("ISSUE_IN_DOC",
2758+
"Please move \"$line\" issue reference before doc request\n");
2759+
}
27262760
if ($in_commit_log && $line =~ /^\@TarantoolBot document$/) {
27272761
$has_doc = 1;
27282762
}

0 commit comments

Comments
 (0)