From 32e3bb6e72b8dd84d6f711a8b2c6db879d169279 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 May 2014 22:12:17 +0300 Subject: Add basic license checking. --- src/Makefile.am | 3 ++- src/rules/license.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 src/rules/license.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 7b6a355..642485d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,8 @@ mplint_SOURCES = \ stringvector.h \ template.hpp \ rules/debug.cpp \ - rules/dump.cpp + rules/dump.cpp \ + rules/license.cpp # set the include path found by configure AM_CPPFLAGS = $(all_includes) diff --git a/src/rules/license.cpp b/src/rules/license.cpp new file mode 100644 index 0000000..d70a051 --- /dev/null +++ b/src/rules/license.cpp @@ -0,0 +1,47 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "template.hpp" + +registerRuleExt(license, "005", "(.+)[.](h|cpp)") + +startRule(license) +{ +} + +endRule(license) +{ +} + +parseLineRule(license) +{ + if (line == 0 && data != "/*") + { + print("Should be license header"); + terminateRule(); + return; + } + else if (line == 1 && data != " * The ManaPlus Client") + { + print("Should be 'The ManaPlus Client' in header"); + terminateRule(); + return; + } +} -- cgit v1.2.3-60-g2f50