From 444612f407c7500f3cf8d8fcf3bb28bc1c0937f4 Mon Sep 17 00:00:00 2001 From: Thomas Oster <thomas.oster@rwth-aachen.de> Date: Thu, 21 Feb 2013 08:26:16 +0100 Subject: [PATCH] added test-script for code sanity (to be extended) --- copyrightheader | 18 ++++++++++++++++++ test.sh | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 copyrightheader create mode 100755 test.sh diff --git a/copyrightheader b/copyrightheader new file mode 100644 index 0000000..5eae2ce --- /dev/null +++ b/copyrightheader @@ -0,0 +1,18 @@ +/** + * This file is part of LibLaserCut. + * Copyright (C) 2011 - 2013 Thomas Oster <thomas.oster@rwth-aachen.de> + * RWTH Aachen University - 52062 Aachen, Germany + * + * LibLaserCut is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LibLaserCut is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with LibLaserCut. If not, see <http://www.gnu.org/licenses/>. + **/ diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..720898b --- /dev/null +++ b/test.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Performs some sanity and code cleanness tests. Intended to be run before every commit + +echo "Checking for copryight header" +if ! [ -f copyrightheader ] +then + echo "File 'copyrightheader' is missing" + exit 1 +fi +HEADERSIZE=$(wc -l < copyrightheader) +ERRORS=0 +for f in $(find src -name '*.java') +do + if ! cat $f|head -n $HEADERSIZE|diff - copyrightheader > /dev/null + then + echo "Copyright header mismatch on $f" + ERRORS=1 + fi +done +exit $ERRORS -- GitLab