From 847aa8f9b3951448e36e9fd353b94e904cdfd84d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 25 May 2014 01:37:54 +0300 Subject: Add into license rule checking for GPL version. --- src/rules/license.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/rules/license.cpp b/src/rules/license.cpp index cc0fa8c..fe81816 100644 --- a/src/rules/license.cpp +++ b/src/rules/license.cpp @@ -22,6 +22,8 @@ bool afterCopyrights(false); bool foundManaPlus(false); +bool checkText(false); +bool foundLicenseNumber(false); registerRuleExt(license, "005", "(.+)[.](h|cpp)") @@ -34,6 +36,8 @@ startRule(license) } afterCopyrights = false; foundManaPlus = false; + checkText = false; + foundLicenseNumber = false; } endRule(license) @@ -56,7 +60,22 @@ parseLineRule(license) } else if (line > 1) { - if (!afterCopyrights) + if (checkText) + { + if (data == " */") + { + if (!foundLicenseNumber) + print("License version not found. It must be GPL 2"); + terminateRule(); + } + else if (data == " * the Free Software Foundation;" + " either version 2 of the License, or") + { + foundLicenseNumber = true; + terminateRule(); + } + } + else if (!afterCopyrights) { if (data == " *") { @@ -79,7 +98,7 @@ parseLineRule(license) { if (data != " * This file is part of The ManaPlus Client.") print("Missing \"This file is part of The ManaPlus Client.\""); - terminateRule(); + checkText = true; } } } -- cgit v1.2.3-60-g2f50