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
2 changes: 1 addition & 1 deletion Engine/Commands/InvokeScriptAnalyzerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ private void AnalyzeFile(string filePath)
}
}

if ((includeRule == null || includeRegexMatch) && (excludeRule == null || excludeRegexMatch))
if ((includeRule == null || includeRegexMatch) && (excludeRule == null || !excludeRegexMatch))
{
WriteVerbose(string.Format(CultureInfo.CurrentCulture, Strings.VerboseRunningMessage, dscResourceRule.GetName()));

Expand Down
2 changes: 2 additions & 0 deletions Engine/SpecialVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ internal enum PreferenceVariable
Confirm = 14,
}

internal const string Host = "Host";
internal const string HistorySize = "MaximumHistoryCount";
internal const string OutputEncoding = "OutputEncoding";
internal const string NestedPromptLevel = "NestedPromptLevel";
Expand All @@ -159,6 +160,7 @@ internal enum PreferenceVariable

internal static readonly string[] OtherInitializedVariables = new string[]
{
Host,
HistorySize,
OutputEncoding,
NestedPromptLevel,
Expand Down
3 changes: 3 additions & 0 deletions Tests/Rules/AvoidGlobalOrUnitializedVarsNoViolations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ function Test {

$a = 3;

#should not raise error
$Host

"hi there!" -match "hi" | Out-Null;
$matches[0];

Expand Down