summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-24 22:12:17 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-24 22:12:17 +0300
commit32e3bb6e72b8dd84d6f711a8b2c6db879d169279 (patch)
tree5a13dfb7c874e062ddd743e09796ff9ad5b6a2a6
parent8d36964bd12e94898d4a4e25c124b72a8926f424 (diff)
downloadmplint-32e3bb6e72b8dd84d6f711a8b2c6db879d169279.tar.gz
mplint-32e3bb6e72b8dd84d6f711a8b2c6db879d169279.tar.bz2
mplint-32e3bb6e72b8dd84d6f711a8b2c6db879d169279.tar.xz
mplint-32e3bb6e72b8dd84d6f711a8b2c6db879d169279.zip
Add basic license checking.
-rw-r--r--src/Makefile.am3
-rw-r--r--src/rules/license.cpp47
2 files changed, 49 insertions, 1 deletions
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 <http://www.gnu.org/licenses/>.
+ */
+
+#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;
+ }
+}