From 6e893308edbbcc9b82dac5112ec62a36549ae1d9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 25 May 2014 01:31:15 +0300 Subject: Improve license checking. --- src/rules/license.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/rules/license.cpp b/src/rules/license.cpp index 06eda18..cc0fa8c 100644 --- a/src/rules/license.cpp +++ b/src/rules/license.cpp @@ -20,6 +20,9 @@ #include "template.hpp" +bool afterCopyrights(false); +bool foundManaPlus(false); + registerRuleExt(license, "005", "(.+)[.](h|cpp)") startRule(license) @@ -29,6 +32,8 @@ startRule(license) { terminateRule(); } + afterCopyrights = false; + foundManaPlus = false; } endRule(license) @@ -49,4 +54,32 @@ parseLineRule(license) terminateRule(); return; } + else if (line > 1) + { + if (!afterCopyrights) + { + if (data == " *") + { + if (!foundManaPlus) + print("Missing ManaPlus developers copyrights"); + afterCopyrights = true; + } + else if (strStartWith(data, " * Copyright (C) ")) + { + if (data.find("The ManaPlus Developers") != std::string::npos) + foundManaPlus = true; + } + else + { + print("Missing copyrights section"); + terminateRule(); + } + } + else + { + if (data != " * This file is part of The ManaPlus Client.") + print("Missing \"This file is part of The ManaPlus Client.\""); + terminateRule(); + } + } } -- cgit v1.2.3-70-g09d2