| 290 | } |
| 291 | |
| 292 | std::string Settings::applyEnabled(const std::string &str, bool enable) |
| 293 | { |
| 294 | std::tuple<SimpleEnableGroup<Severity>, SimpleEnableGroup<Checks>> groups; |
| 295 | std::string errmsg = parseEnabled(str, groups); |
| 296 | if (!errmsg.empty()) |
| 297 | return (enable ? "--enable" : "--disable") + errmsg; |
| 298 | |
| 299 | const auto s = std::get<0>(groups); |
| 300 | const auto c = std::get<1>(groups); |
| 301 | if (enable) { |
| 302 | severity.enable(s); |
| 303 | checks.enable(c); |
| 304 | } |
| 305 | else { |
| 306 | severity.disable(s); |
| 307 | checks.disable(c); |
| 308 | } |
| 309 | // FIXME: hack to make sure "error" is always enabled |
| 310 | severity.enable(Severity::error); |
| 311 | return {}; |
| 312 | } |
| 313 | |
| 314 | bool Settings::isEnabled(const ValueFlow::Value *value, bool inconclusiveCheck) const |
| 315 | { |