diff --git a/src/Analyzer.Core/TemplateAnalyzer.cs b/src/Analyzer.Core/TemplateAnalyzer.cs index ba1571b9..c9c147e3 100644 --- a/src/Analyzer.Core/TemplateAnalyzer.cs +++ b/src/Analyzer.Core/TemplateAnalyzer.cs @@ -34,7 +34,7 @@ public class TemplateAnalyzer private ILogger logger; /// - /// Private constructor to enforce use of for creating new instances. + /// Private constructor to enforce using one of the TemplateAnalyzer.Create methods for creating new instances. /// /// The to use in analyzing templates. /// The to use in analyzing templates. @@ -66,9 +66,22 @@ public static TemplateAnalyzer Create(bool includeNonSecurityRules, ILogger logg throw new TemplateAnalyzerException("Failed to read rules.", e); } + return Create(includeNonSecurityRules: includeNonSecurityRules, includePowerShellRules: includePowerShellRules, rulesJsonAsString: rules, logger: logger); + } + + /// + /// Creates a new instance. + /// + /// Whether or not to run also non-security rules against the template. + /// The rules to evaluate, in JSON string format. + /// A logger to report errors and debug information + /// Whether or not to run also powershell rules against the template. + /// A new instance. + public static TemplateAnalyzer Create(bool includeNonSecurityRules, bool includePowerShellRules, string rulesJsonAsString, ILogger logger = null) + { return new TemplateAnalyzer( JsonRuleEngine.Create( - rules, + rulesJsonAsString, templateContext => templateContext.IsBicep ? new BicepSourceLocationResolver(templateContext) : new JsonSourceLocationResolver(templateContext), diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 0cb24db7..d303607c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,6 +1,6 @@ - 0.8.3 + 0.8.4 Microsoft © Microsoft Corporation. All rights reserved.