diff options
author | Luca Di Sera <luca.disera@qt.io> | 2022-06-23 11:24:31 +0200 |
---|---|---|
committer | Luca Di Sera <luca.disera@qt.io> | 2022-06-28 08:29:06 +0000 |
commit | 1d75b08b83c5d27cf6e0af1b7117e0c396aa3b1c (patch) | |
tree | b42e1ee8aee8d63a1baa797807fa6fb42283be80 | |
parent | 29e530658ff2a1b187f35f0732e7a5472e08d608 (diff) |
Warn about header files with a common non-.h extension
It is an implied convention in the Qt project that header files should
use a ".h" extension.
As this might non be known by a contributor (especially if the
contributor is from outside the QtCompany) or escape review, possibly
requiring a bigger amount of work to change later, a new warning in the
commit sanitizer script was included to warn about new files that have
some common header extension that is not ".h".
Change-Id: I83a25d829a63811c08a11f2a337707c62423f699
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
-rwxr-xr-x | git-hooks/sanitize-commit | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index b84e1ab..da73988 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -718,6 +718,7 @@ sub flushFile() my $merge; my $new_file; +my $foreign; my $is_bin; my $maybe_bin; my $is_special; @@ -771,6 +772,8 @@ while (<DIFF>) { } elsif ($file =~ /\.(prl|la|pc|ilk)$/i) { complain("Adding build artifact", "generated") if ($new_file && !defined($cfg{generated})); $ws_check = 0; + } elsif ($file =~ /\.(hpp|ch|h\+\+|hh|hxx)$/i) { + complain("Adding header file with a non-.h extension", "extension") if ($new_file && !$foreign && !defined($cfg{extension})); } elsif ($file !~ /\.qmltypes$/i) { $check_gen = 1; } @@ -875,7 +878,7 @@ while (<DIFF>) { $clike = ($file =~ /\.(c|cc|cpp|c\+\+|cxx|qdoc|m|mm|h|hpp|hxx|cs|java|js|qs|qml|g|y|ypp|pl|glsl)$/i); $qmake = ($file =~ /\.pr[filo]$/i); $is_bin = ($file =~ /\.(ps|pdf)$/); - my $foreign = $is_bin || ($file =~ /(^|\/)3rdparty\//); + $foreign = $is_bin || ($file =~ /(^|\/)3rdparty\//); $new_file = 0; $maybe_bin = 0; $is_special = 0; |