Skip to content

Commit

Permalink
Fix terms checker issues (PowerShell#12189)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveL-MSFT committed Mar 24, 2020
1 parent b7cb335 commit f23be43
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ private void WriteToConsole(ReadOnlySpan<char> value, bool transcribeResult, boo

private void WriteToConsole(ConsoleColor foregroundColor, ConsoleColor backgroundColor, string text, bool newLine = false)
{
// Sync access so that we don't race on color settings if called from multiple threads.
// Sync access so that we don't conflict on color settings if called from multiple threads.
lock (_instanceLock)
{
ConsoleColor fg = RawUI.ForegroundColor;
Expand Down Expand Up @@ -779,7 +779,7 @@ public override void WriteLine(ConsoleColor foregroundColor, ConsoleColor backgr

private void Write(ConsoleColor foregroundColor, ConsoleColor backgroundColor, string value, bool newLine)
{
// Sync access so that we don't race on color settings if called from multiple threads.
// Sync access so that we don't conflict on color settings if called from multiple threads.
lock (_instanceLock)
{
ConsoleColor fg = RawUI.ForegroundColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ private void InitializeCommandsHardWired(ExecutionContext context)
additional types. Adding a handler here would cause a new sub-pipeline
to be created.
For example, the following line would add a new handler named "out-foobar"
to be invoked when the incoming object type is "MyNamespace.Whatever.FooBar"
For example, the following line would add a new handler named "out-example"
to be invoked when the incoming object type is "MyNamespace.Whatever.Example"
RegisterCommandForTypes (context, "out-foobar", new string[] { "MyNamespace.Whatever.FooBar" });
RegisterCommandForTypes (context, "out-example", new string[] { "MyNamespace.Whatever.Example" });
And the method can be like this:
private void RegisterCommandForTypes (ExecutionContext context, string commandName, Type commandType, string[] types)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1751,10 +1751,10 @@ protected override void BeginProcessing()
/// c:\temp\mdir\mdir # resolve by using extensions. mdir is a directory, mdir.xxx is a file.
/// c:\temp\mdir # load default module if mdir is directory
/// module # $PSScriptRoot/module/module.psd1 (ps1,psm1,dll)
/// module/foobar.psm1 # $PSScriptRoot/module/module.psm1
/// module/foobar # $PSScriptRoot/module/foobar.XXX if foobar is not a directory...
/// module/foobar # $PSScriptRoot/module/foobar is a directory and $PSScriptRoot/module/foobar/foobar.XXX exists
/// module/foobar/foobar.XXX
/// module/examplemodule.psm1 # $PSScriptRoot/module/module.psm1
/// module/examplemodule # $PSScriptRoot/module/examplemodule.XXX if examplemodule is not a directory...
/// module/examplemodule # $PSScriptRoot/module/examplemodule is a directory and $PSScriptRoot/module/examplemodule/examplemodule.XXX exists
/// module/examplemodule/examplemodule.XXX
/// </remarks>
protected override void ProcessRecord()
{
Expand Down
22 changes: 11 additions & 11 deletions src/System.Management.Automation/engine/SessionStateVariableAPIs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal void AddSessionStateEntry(SessionStateVariableEntry entry)

/// <summary>
/// Get a variable out of session state. This interface supports
/// the scope specifiers like "global:foobar"
/// the scope specifiers like "global:example"
/// </summary>
/// <param name="name">
/// name of variable to look up
Expand Down Expand Up @@ -67,7 +67,7 @@ internal PSVariable GetVariable(string name, CommandOrigin origin)

/// <summary>
/// Get a variable out of session state. This interface supports
/// the scope specifiers like "global:foobar"
/// the scope specifiers like "global:example"
/// </summary>
/// <param name="name">
/// name of variable to look up
Expand All @@ -86,7 +86,7 @@ internal PSVariable GetVariable(string name)
/// <summary>
/// Get a variable out of session state. This interface supports
/// the "namespace:name" syntax so you can do things like
/// "env:PATH" or "global:foobar"
/// "env:PATH" or "global:example"
/// </summary>
/// <param name="name">
/// name of variable to look up
Expand Down Expand Up @@ -129,7 +129,7 @@ internal object GetVariableValue(string name)
/// <summary>
/// Get a variable out of session state. This interface supports
/// the "namespace:name" syntax so you can do things like
/// "env:PATH" or "global:foobar"
/// "env:PATH" or "global:example"
/// </summary>
/// <param name="name">
/// name of variable to look up
Expand Down Expand Up @@ -595,7 +595,7 @@ internal object GetVariableValue(string name, object defaultValue)
/// <summary>
/// Get a variable out of session state. This interface supports
/// the "namespace:name" syntax so you can do things like
/// "env:PATH" or "global:foobar"
/// "env:PATH" or "global:example"
/// </summary>
/// <param name="name">
/// name of variable to look up
Expand Down Expand Up @@ -646,7 +646,7 @@ internal PSVariable GetVariableAtScope(string name, string scopeID)
/// <summary>
/// Get a variable out of session state. This interface supports
/// the "namespace:name" syntax so you can do things like
/// "env:PATH" or "global:foobar"
/// "env:PATH" or "global:example"
/// </summary>
/// <param name="name">
/// name of variable to look up
Expand Down Expand Up @@ -922,7 +922,7 @@ internal object GetAutomaticVariableValue(AutomaticVariable variable)
/// <summary>
/// Set a variable in session state. This interface supports
/// the "namespace:name" syntax so you can do things like
/// "$env:PATH = 'c:\windows'" or "$global:foobar = 13"
/// "$env:PATH = 'c:\windows'" or "$global:example = 13"
/// </summary>
/// <param name="name">
/// The name of the item to set.
Expand Down Expand Up @@ -967,7 +967,7 @@ internal void SetVariableValue(string name, object newValue, CommandOrigin origi
/// <summary>
/// Set a variable in session state. This interface supports
/// the "namespace:name" syntax so you can do things like
/// "$env:PATH = 'c:\windows'" or "$global:foobar = 13"
/// "$env:PATH = 'c:\windows'" or "$global:example = 13"
///
/// BUGBUG: this overload exists because a lot of tests in the
/// testsuite use it. Those tests should eventually be fixed and this overload
Expand Down Expand Up @@ -1005,7 +1005,7 @@ internal void SetVariableValue(string name, object newValue)

/// <summary>
/// Set a variable in session state. This interface supports
/// the scope specifiers like "$global:foobar = 13"
/// the scope specifiers like "$global:example = 13"
/// </summary>
/// <param name="variable">
/// The variable to be set.
Expand Down Expand Up @@ -1639,7 +1639,7 @@ internal void RemoveVariable(PSVariable variable, bool force)
/// <summary>
/// Remove a variable from session state. This interface supports
/// the "namespace:name" syntax so you can do things like
/// "env:PATH" or "global:foobar"
/// "env:PATH" or "global:example"
/// </summary>
/// <param name="name">
/// name of variable to remove
Expand Down Expand Up @@ -1669,7 +1669,7 @@ internal void RemoveVariableAtScope(string name, string scopeID)
/// <summary>
/// Remove a variable from session state. This interface supports
/// the "namespace:name" syntax so you can do things like
/// "env:PATH" or "global:foobar"
/// "env:PATH" or "global:example"
/// </summary>
/// <param name="name">
/// name of variable to remove
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4887,7 +4887,7 @@ private StatementAst UsingStatementRule(Token usingToken)
{
case TokenKind.EndOfInput:
case TokenKind.NewLine:
// Example: 'using module ,FooBar'
// Example: 'using module ,exampleModuleName'
// GetCommandArgument will successfully return an argument for a unary array argument
// but we don't want to allow that syntax with a using statement.
case TokenKind.Comma:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ internal bool CanByPassRaiseEvent(RemoteSessionStateMachineEventArgs arg)
_state == RemoteSessionState.EstablishedAndKeyReceived || // TODO - Client session would never get into this state... to be removed
_state == RemoteSessionState.EstablishedAndKeySent ||
_state == RemoteSessionState.Disconnecting || // There can be input data until disconnect has been completed
_state == RemoteSessionState.Disconnected) // Data can arrive while state machine is transitioning to disconnected, in a race.
_state == RemoteSessionState.Disconnected) // Data can arrive while state machine is transitioning to disconnected
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ internal void ReportContext()
PSKeyword.ManagedPlugin | PSKeyword.UseAlwaysAnalytic,
creationRequestDetails.ToString(), creationRequestDetails.ToString());

// RACE TO BE FIXED - As soon as this API is called, WinRM service will send CommandResponse back and Signal is expected anytime
// TO BE FIXED - As soon as this API is called, WinRM service will send CommandResponse back and Signal is expected anytime
// If Signal comes and executes before registering the notification handle, cleanup will be messed
result = WSManNativeApi.WSManPluginReportContext(creationRequestDetails.unmanagedHandle, 0, creationRequestDetails.unmanagedHandle);
if (Platform.IsWindows && (WSManPluginConstants.ExitCodeSuccess == result))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,9 @@ internal void ExecuteConnect(byte[] connectData, out byte[] connectResponseData)
}

// we currently dont support adjusting runspace count on a connect operation.
// there is a potential race here where in the runspace pool driver is still yet to process a queued
// there is a potential conflict here where in the runspace pool driver is still yet to process a queued
// setMax or setMinrunspaces request.
// TODO: resolve this race.. probably by letting the runspace pool consume all messages before we execute this.
// TODO: resolve this.. probably by letting the runspace pool consume all messages before we execute this.
if (clientRequestedRunspaceCount
&& (_runspacePoolDriver.RunspacePool.GetMaxRunspaces() != clientRequestedMaxRunspaces)
&& (_runspacePoolDriver.RunspacePool.GetMinRunspaces() != clientRequestedMinRunspaces))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5246,7 +5246,7 @@ public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, Dy

if (adapterData.member.DeclaringType.IsGenericTypeDefinition || adapterData.propertyType.IsByRefLike)
{
// This is kinda lame - we really should throw an error, but accessing property getter
// We really should throw an error, but accessing property getter
// doesn't throw error in PowerShell since V2, even in strict mode.
expr = ExpressionCache.NullConstant;
}
Expand Down
4 changes: 2 additions & 2 deletions test/powershell/Language/Parser/Parser.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ foo``u{2195}abc
}

It "Test that escaping any character with no special meaning just returns that char. (line 602)" {
$result = ExecuteCommand '"fo`obar"'
$result | Should -BeExactly "foobar"
$result = ExecuteCommand '"fo`odbar"'
$result | Should -BeExactly "foodbar"
}

Context "Test that we support all of the C# escape sequences. We use the ` instead of \. (line 613)" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,16 @@ Describe "Get-ChildItem" -Tags "CI" {
It 'can handle mixed case in Env variables' {
try
{
$env:__FOOBAR = 'foo'
$env:__foobar = 'bar'
$env:__FOODBAR = 'food'
$env:__foodbar = 'bar'

$foobar = Get-Childitem env: | Where-Object {$_.Name -eq '__foobar'}
$foodbar = Get-Childitem env: | Where-Object {$_.Name -eq '__foodbar'}
$count = if ($IsWindows) { 1 } else { 2 }
($foobar | Measure-Object).Count | Should -Be $count
($foodbar | Measure-Object).Count | Should -Be $count
}
catch
{
Get-ChildItem env: | Where-Object {$_.Name -eq '__foobar'} | Remove-Item -ErrorAction SilentlyContinue
Get-ChildItem env: | Where-Object {$_.Name -eq '__foodbar'} | Remove-Item -ErrorAction SilentlyContinue
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Describe "Export-Alias DRT Unit Tests" -Tags "CI" {
}

It "Export-Alias with Invalid Scope will throw PSArgumentException" {
{ Export-Alias $fulltestpath -scope foobar } | Should -Throw -ErrorId "Argument,Microsoft.PowerShell.Commands.ExportAliasCommand"
{ Export-Alias $fulltestpath -scope foodbar } | Should -Throw -ErrorId "Argument,Microsoft.PowerShell.Commands.ExportAliasCommand"
}

It "Export-Alias for Default"{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ Describe "Format-Table" -Tags "CI" {
@{ testName = "array" ; testString = "line1","line2" }
) {
param ($testString)
$result = $testString | Format-Table -Property "foo","bar" -Force | Out-String
$result.Replace(" ","").Replace([Environment]::NewLine,"") | Should -BeExactly "foobar------"
$result = $testString | Format-Table -Property "fox","bar" -Force | Out-String
$result.Replace(" ","").Replace([Environment]::NewLine,"") | Should -BeExactly "foxbar------"
}

It "Format-Table with complex object for End-To-End should work" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ Describe "Get-Command Feature tests" -Tag Feature {
$manifestPath = Join-Path $testdrive "test.psd1"
$modulePath = Join-Path $testdrive "test.psm1"

New-ModuleManifest -Path $manifestPath -FunctionsToExport "Get-FooBar","Get-FB" -RootModule test.psm1
New-ModuleManifest -Path $manifestPath -FunctionsToExport "Get-FoodBar","Get-FB" -RootModule test.psm1
@"
function Get-FooBar { "foobar" }
function Get-FoodBar { "foodbar" }
function Get-FB { "fb" }
"@ > $modulePath

try {
Import-Module $manifestPath
$results = Get-Command g-fb -UseAbbreviationExpansion
$results | Should -HaveCount 2
$results[0].Name | Should -BeIn "Get-FB","Get-FooBar"
$results[1].Name | Should -BeIn "Get-FB","Get-FooBar"
$results[0].Name | Should -BeIn "Get-FB","Get-FoodBar"
$results[1].Name | Should -BeIn "Get-FB","Get-FoodBar"
$results[0].Name | Should -Not -Be $results[1].Name
}
finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ Describe "Test PSDesiredStateConfiguration" -tags CI {
}

try {
Invoke-DscResource -Name xWebSite -ModuleName 'xWebAdministration' -Method Test -Property @{TestScript = 'foobar' } -ErrorAction Stop -WarningVariable warnings
Invoke-DscResource -Name xWebSite -ModuleName 'xWebAdministration' -Method Test -Property @{TestScript = 'foodbar' } -ErrorAction Stop -WarningVariable warnings
}
catch{
#this will fail too, but that is nat what we are testing...
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/engine/Help/HelpSystem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ Describe "Help failure cases" -Tags Feature {
) {
param($command)

{ & $command foobar -ErrorAction Stop } | Should -Throw -ErrorId "HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand"
{ & $command DoesNotExist -ErrorAction Stop } | Should -Throw -ErrorId "HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand"
}
}

Expand Down

0 comments on commit f23be43

Please sign in to comment.