Skip to content

Commit 4042839

Browse files
committed
Merge pull request #277 from PowerShell/BugFixes
Take Bug fixes to Master
2 parents b4e890c + 22d7bb8 commit 4042839

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

Engine/Commands/InvokeScriptAnalyzerCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ private void AnalyzeFile(string filePath)
530530
}
531531
}
532532

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

Engine/SpecialVars.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ internal enum PreferenceVariable
140140
Confirm = 14,
141141
}
142142

143+
internal const string Host = "Host";
143144
internal const string HistorySize = "MaximumHistoryCount";
144145
internal const string OutputEncoding = "OutputEncoding";
145146
internal const string NestedPromptLevel = "NestedPromptLevel";
@@ -159,6 +160,7 @@ internal enum PreferenceVariable
159160

160161
internal static readonly string[] OtherInitializedVariables = new string[]
161162
{
163+
Host,
162164
HistorySize,
163165
OutputEncoding,
164166
NestedPromptLevel,

Tests/Rules/AvoidGlobalOrUnitializedVarsNoViolations.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ function Test {
99

1010
$a = 3;
1111

12+
#should not raise error
13+
$Host
14+
1215
"hi there!" -match "hi" | Out-Null;
1316
$matches[0];
1417

0 commit comments

Comments
 (0)