From 934ec27a783a7ad02a078160c1010a6d443b3437 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 25 May 2014 12:16:28 +0300 Subject: Count line numbers from 1. --- src/lintmanager.cpp | 2 +- src/rulebase.cpp | 4 ++-- src/rules/license.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lintmanager.cpp b/src/lintmanager.cpp index 97ee925..bba2926 100644 --- a/src/lintmanager.cpp +++ b/src/lintmanager.cpp @@ -114,7 +114,7 @@ void LintManager::applyRulesToFile() FOR_EACH (std::vector::iterator, it, mSelectedRules) { RuleBase *const rule = *it; - int line = 0; + int line = 1; FOR_EACH (std::vector::const_iterator, itStr, mFileData) { const std::string &str = *itStr; diff --git a/src/rulebase.cpp b/src/rulebase.cpp index 9cbf8bb..8b34ffe 100644 --- a/src/rulebase.cpp +++ b/src/rulebase.cpp @@ -27,7 +27,7 @@ RuleBase::RuleBase() : file(), ruleName(), - line(-1), + line(0), flag(true) { lint.addRule(this); @@ -65,5 +65,5 @@ void RuleBase::terminateRule() void RuleBase::init() { flag = true; - line = 0; + line = 1; } diff --git a/src/rules/license.cpp b/src/rules/license.cpp index fe81816..0ec320e 100644 --- a/src/rules/license.cpp +++ b/src/rules/license.cpp @@ -46,19 +46,19 @@ endRule(license) parseLineRule(license) { - if (line == 0 && data != "/*") + if (line == 1 && data != "/*") { print("Should be license header"); terminateRule(); return; } - else if (line == 1 && data != " * The ManaPlus Client") + else if (line == 2 && data != " * The ManaPlus Client") { print("Should be 'The ManaPlus Client' in header"); terminateRule(); return; } - else if (line > 1) + else if (line > 2) { if (checkText) { -- cgit v1.2.3-60-g2f50