summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-25 01:37:54 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-25 01:47:02 +0300
commit847aa8f9b3951448e36e9fd353b94e904cdfd84d (patch)
tree282e4e0b3395089a6c838b2d2b2d1aa293500aa2
parent6e893308edbbcc9b82dac5112ec62a36549ae1d9 (diff)
downloadmplint-847aa8f9b3951448e36e9fd353b94e904cdfd84d.tar.gz
mplint-847aa8f9b3951448e36e9fd353b94e904cdfd84d.tar.bz2
mplint-847aa8f9b3951448e36e9fd353b94e904cdfd84d.tar.xz
mplint-847aa8f9b3951448e36e9fd353b94e904cdfd84d.zip
Add into license rule checking for GPL version.
-rw-r--r--src/rules/license.cpp23
1 files 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;
}
}
}