[Libreoffice] [PATCH] git-hooks: warn about undocumented classes in new hxx files on commit

Miklos Vajna vmiklos at frugalware.org
Wed Jan 19 15:28:57 PST 2011


Hi,

I'm attaching a patch that makes the pre-commit hook warn on introducing
undocumented classes.

To avoid being agressive:

- it just warns, does not error out
- it just checks for undocuemnted classes in new hxx files

On my (not so fast) netbook the check takes about 0.3s for each added
hxx file, I hope that's an acceptable slowdown.

OK to push to master?

Thanks.
-------------- next part --------------
From e8c2626202cf1de1a0d70007360a01e58eee6253 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos at frugalware.org>
Date: Thu, 20 Jan 2011 00:16:32 +0100
Subject: [PATCH] git-hooks: warn about undocumented classes in new hxx files on commit

---
 git-hooks/pre-commit |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit
index b6581a4..cee3a7f 100755
--- a/git-hooks/pre-commit
+++ b/git-hooks/pre-commit
@@ -8,6 +8,7 @@
 use strict;
 use File::Temp qw/ :mktemp  /;
 use File::Copy;
+use Cwd;
 
 $ENV{LC_ALL} = "C";
 
@@ -119,6 +120,20 @@ EOM
     exit( 1 );
 }
 
+# check for missing doxygen comments in new files
+my $doxycheck = "../../bin/find-undocumented-classes";
+if (! -e $doxycheck) {
+    # bootstrap repo
+    $doxycheck =~ s|../../||;
+}
+open(FILES, "git diff-index --cached --name-only --diff-filter=A $against |") || die "Cannot run git diff-index.";
+while (my $file = <FILES>) {
+    chomp($file);
+    if ($file =~ /\.hxx$/) {
+        system("$doxycheck -q $file | sed 's|".getcwd()."/||;'");
+    }
+}
+
 # be strict about tabs - we don't want them at all, setup your editor
 # correctly ;-)
 my $err_ext = "";
-- 
1.7.3.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110120/73a7bec1/attachment.pgp>


More information about the LibreOffice mailing list