示例#1
0
文件: Options.cpp 项目: oclint/oclint
static void processConfigFile(const std::string &path)
{
    oclint::option::ConfigFile config(path);
    for (const oclint::option::RuleConfigurationPair &ruleConfig : config.ruleConfigurations())
    {
        consumeRuleConfiguration(ruleConfig.key(), ruleConfig.value());
    }
    for (const llvm::StringRef &rulePath : config.rulePaths())
    {
        argRulesPath.push_back(rulePath.str());
    }
    std::vector<std::string> enableRules;
    for (auto rule : config.rules())
    {
        enableRules.push_back(rule.str());
    }
    filter.enableRules(enableRules.begin(), enableRules.end());
    std::vector<std::string> disableRules;
    for (auto rule : config.disableRules())
    {
        disableRules.push_back(rule.str());
    }
    filter.disableRules(disableRules.begin(), disableRules.end());

    updateArgIfSet(argOutput, config.output());
    updateArgIfSet(argReportType, config.reportType());
    updateArgIfSet(argMaxP1, config.maxP1());
    updateArgIfSet(argMaxP2, config.maxP2());
    updateArgIfSet(argMaxP3, config.maxP3());
    updateArgIfSet(argGlobalAnalysis, config.enableGlobalAnalysis());
    updateArgIfSet(argClangChecker, config.clangChecker());
    updateArgIfSet(argDuplications, config.allowDuplicatedViolations());
}
示例#2
0
static void processConfigFile(const std::string &path)
{
    oclint::option::ConfigFile config(path);
    for (const oclint::option::RuleConfigurationPair &ruleConfig : config.ruleConfigurations())
    {
        oclint::RuleConfiguration::addConfiguration(ruleConfig.key(), ruleConfig.value());
    }
    for (const llvm::StringRef &rulePath : config.rulePaths())
    {
        argRulesPath.push_back(rulePath.str());
    }
    filter.enableRules(config.rules().begin(), config.rules().end());
    filter.disableRules(config.disableRules().begin(), config.disableRules().end());

    updateArgIfSet(argOutput, config.output());
    updateArgIfSet(argReportType, config.reportType());
    updateArgIfSet(argMaxP1, config.maxP1());
    updateArgIfSet(argMaxP2, config.maxP2());
    updateArgIfSet(argMaxP3, config.maxP3());
    updateArgIfSet(argClangChecker, config.clangChecker());
    updateArgIfSet(argDuplications, config.allowDuplicatedViolations());
}