mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
PSScriptAnalyzer fixes by category (#4261)
- Fix PSScriptAnalyzer warnings of type PSAvoidUsingCmdletAliases for 'ForEach-Object' (alias is '%' or 'foreach') - Fix PSScriptAnalyzer warnings of type PSAvoidUsingCmdletAliases for 'Where-Object' (alias is '?' or 'where') - Fix PSScriptAnalyzer warnings of type PSAvoidUsingCmdletAliases for 'Select-Object' (alias is 'select') - Fix PSScriptAnalyzer warnings of type PSPossibleIncorrectComparisonWithNull. Essentially, $null has to be on the left-hand side when using it for comparison. - A Test in ParameterBinding.Tests.ps1 needed adapting as this test used to rely on the wrong null comparison - Replace a subset of tests of kind '($object -eq $null) | Should Be $true' with '$object | Should Be $null'
This commit is contained in:
@@ -175,7 +175,7 @@ namespace System.Management.Automation.Language
|
||||
// slot in the tuple. This only matters for value types where we allow
|
||||
// comparisons with $null and don't try to convert the $null value to the
|
||||
// valuetype because the parameter has no value yet. For example:
|
||||
// & { param([System.Reflection.MemberTypes]$m) ($m -eq $null) }
|
||||
// & { param([System.Reflection.MemberTypes]$m) ($null -eq $m) }
|
||||
object unused;
|
||||
if (!Compiler.TryGetDefaultParameterValue(analysisDetails.Type, out unused))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user