Skip to content

Commit 86bfae9

Browse files
author
Kapil Borle
committed
Add method to check if a rule is enabled
1 parent 4d73802 commit 86bfae9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Engine/ScriptAnalyzer.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,21 @@ private bool IsSeverityAllowed(IEnumerable<uint> allowedSeverities, IRule rule)
16431643
&& allowedSeverities.Contains((uint)rule.GetSeverity()));
16441644
}
16451645

1646+
private bool IsRuleEnabled(IRule rule)
1647+
{
1648+
var configurableRule = rule as ConfigurableScriptRule;
1649+
if (configurableRule != null)
1650+
{
1651+
var propertyInfo = configurableRule.GetType().GetProperty("Enable");
1652+
if (propertyInfo != null)
1653+
{
1654+
return propertyInfo.GetValue(configurableRule) as bool? ?? true;
1655+
}
1656+
}
1657+
1658+
return true;
1659+
}
1660+
16461661
IEnumerable<uint> GetAllowedSeveritiesInInt()
16471662
{
16481663
return severity != null

0 commit comments

Comments
 (0)