diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-25 01:31:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-25 01:31:15 +0300 |
commit | 6e893308edbbcc9b82dac5112ec62a36549ae1d9 (patch) | |
tree | 02f05b90cb07b30df9971b4b4dbc67c0c0f1ac0f | |
parent | de51686bb14bca0432fbf046786604518aed85a3 (diff) | |
download | mplint-6e893308edbbcc9b82dac5112ec62a36549ae1d9.tar.gz mplint-6e893308edbbcc9b82dac5112ec62a36549ae1d9.tar.bz2 mplint-6e893308edbbcc9b82dac5112ec62a36549ae1d9.tar.xz mplint-6e893308edbbcc9b82dac5112ec62a36549ae1d9.zip |
Improve license checking.
-rw-r--r-- | src/rules/license.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
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(); + } + } } |