Adds reference docs links, formatting and refactoring test performance test #11077
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
This PR adds many reference links to PowerShell and .NET docs. I'm not sure if the links are correct, please let me know if they should be fixed, I've basically removed
https://learn.microsoft.com/en-us
from them and made them relative hope that's right.There are also many formatting changes and also updated the performance tests for Avoid repeated calls to a function to have the same format as the previous tests.
As aside, I feel that Avoid Write-Host should be removed or rewritten. Haven't removed it in this PR but if you feel the same I can open an issue / make a new PR for that. After discussing it in the pwsh Discord the conclusion was that the recommendation is misleading. The usage of static methods from
System.Console
can be confusing specially for new folks and shouldn't be part of this doc, and the recommendation to useWrite-Output
instead ofWrite-Host
is also incorrect, first, the explicit usage ofWrite-Output
is not needed to begin with and is only useful when preventing pipeline enumeration with-NoEnumerate
or for unrolling a collection i.e.:, (0..10) | Write-Output | ForEach-Object { "[$_]" }
vs, (0..10) | ForEach-Object { "[$_]" }
and second, the purpose ofWrite-Host
is to send information directly to the console and prevent it's output to be captured by default. So if the intent is to offer a better cmdlet for this purpose, a better recommendation would be to useWrite-Verbose
instead ofWrite-Host
?PR Checklist