diff options
Diffstat (limited to 'src/lintmanager.cpp')
-rw-r--r-- | src/lintmanager.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lintmanager.cpp b/src/lintmanager.cpp index bba2926..f595a38 100644 --- a/src/lintmanager.cpp +++ b/src/lintmanager.cpp @@ -21,6 +21,7 @@ #include "lintmanager.h" #include "rulebase.h" +#include "stringutils.h" #include <dirent.h> #include <fstream> @@ -32,15 +33,31 @@ LintManager lint; -LintManager::LintManager() +LintManager::LintManager() : + mFileName(), + mRootPath() { } void LintManager::run(std::string path) { + mRootPath = path; + size_t idx = path.rfind("src/"); + if (idx != std::string::npos) + mRootPath = mRootPath.substr(0, idx); + if (!strEndWith(mRootPath, "/")) + mRootPath.append("/"); + + updateRules(); enumFiles(path); } +void LintManager::updateRules() +{ + FOR_EACH (std::vector<RuleBase*>::iterator, it, mRules) + (*it)->setRootDir(mRootPath); +} + void LintManager::addRule(RuleBase *const rule) { mRules.push_back(rule); |