Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/Analyzer.Core/TemplateAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class TemplateAnalyzer
private ILogger logger;

/// <summary>
/// Private constructor to enforce use of <see cref="TemplateAnalyzer.Create"/> for creating new instances.
/// Private constructor to enforce using one of the TemplateAnalyzer.Create methods for creating new instances.
/// </summary>
/// <param name="jsonRuleEngine">The <see cref="JsonRuleEngine"/> to use in analyzing templates.</param>
/// <param name="powerShellRuleEngine">The <see cref="PowerShellRuleEngine"/> to use in analyzing templates.</param>
Expand Down Expand Up @@ -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);
}

/// <summary>
/// Creates a new <see cref="TemplateAnalyzer"/> instance.
/// </summary>
/// <param name="includeNonSecurityRules">Whether or not to run also non-security rules against the template.</param>
/// <param name="rulesJsonAsString">The rules to evaluate, in JSON string format.</param>
/// <param name="logger">A logger to report errors and debug information</param>
/// <param name="includePowerShellRules">Whether or not to run also powershell rules against the template.</param>
/// <returns>A new <see cref="TemplateAnalyzer"/> instance.</returns>
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),
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.8.3</Version>
<Version>0.8.4</Version>
<Authors>Microsoft</Authors>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
</PropertyGroup>
Expand Down
Loading