diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-05-20 14:49:25 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-05-21 07:24:48 +0000 |
commit | a88102f7a1e68e0f84ce82df3696a40004793d9e (patch) | |
tree | b7d0a8e3fb088ba1566d5dde112eb337d0a89e31 | |
parent | f666e61f5cc8a55855591df926d64747a1d586fb (diff) | |
download | qtrepotools-a88102f7a1e68e0f84ce82df3696a40004793d9e.tar.gz |
sanity: introduce notobjc_check flag variable
amends ac9c5658.
Change-Id: I245729457f54a04eeb076ec04296827901fbd612
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
-rwxr-xr-x | git-hooks/sanitize-commit | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index 573ab9d..98f8ce5 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -726,6 +726,7 @@ my $tsv_check; my $eof_check; my $ctlkw_check; my $apple_check; +my $notobjc_check; open DIFF, "git diff-tree --minimal --no-commit-id --diff-filter=ACMR --ignore-submodules " . "--src-prefix=\@old\@/ --dst-prefix=\@new\@/ --full-index -r -U100000 --cc -C -l1000 " . "--root ".$sha1." |" or die "cannot run git: $!"; @@ -824,11 +825,8 @@ while (<DIFF>) { check_spelling() if ($spell_check); if ($apple_check) { check_apple_terminology(); - if ($file =~ /\.(c|cpp)$/i) { - if (/\b__OBJC__\b/) { - complain_ln("__OBJC__ will never be defined for non-Objective-C/C++ source files", - "objc"); - } + if ($notobjc_check && /\b__OBJC__\b/) { + complain_ln("__OBJC__ will never be defined for non-Objective-C/C++ source files", "objc"); } } } else { @@ -880,6 +878,7 @@ while (<DIFF>) { # .ts files usually contain languages other than English $spell_check = !defined($cfg{spell}) && !$foreign && ($file !~ /\.ts$/i); $apple_check = !$foreign && ($file !~ /\.ts$/i); + $notobjc_check = $apple_check && ($file =~ /\.(c|cc|cpp|c\+\+|cxx)$/i); $conflict_fail = $is_bin || defined($cfg{conflict}); $braces = 0; $check_gen = 0; |