diff --git a/src/rule/index.ts b/src/rule/index.ts index 7b22011..a9c9f11 100644 --- a/src/rule/index.ts +++ b/src/rule/index.ts @@ -176,31 +176,15 @@ export async function resolveRules(rules: Array, selector: RuleSelector): for (const r of rules) { let active = false; - if (selector.includeLevel.includes(r.level)) { - active = true; - } - - if (selector.includeName.includes(r.name)) { - active = true; - } - + active = active || selector.includeLevel.includes(r.level); + active = active || selector.includeName.includes(r.name); const includedTags = intersection(selector.includeTag, r.tags); - if (includedTags.length > 0) { - active = true; - } - - if (selector.excludeLevel.includes(r.level)) { - active = false; - } - - if (selector.excludeName.includes(r.name)) { - active = false; - } + active = active || includedTags.length > 0; + active = active && (!selector.excludeLevel.includes(r.level)); + active = active && (!selector.excludeName.includes(r.name)); const excludedTags = intersection(selector.excludeTag, r.tags); - if (excludedTags.length > 0) { - active = false; - } + active = active && (excludedTags.length === 0); if (active) { activeRules.add(r);