-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Bug Fix: Buse boolean in comparision #28653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug in PowerShell boolean comparisons by explicitly comparing boolean values with $true
instead of relying on implicit boolean evaluation.
Changes Made:
- Replaced direct function calls in if statements with explicit boolean variable assignments and comparisons
- Applied consistent formatting for boolean condition checks
if (Test-ComputerNameHasDnsSuffix -ComputerName $ComputerName) | ||
$computerNameHasDNSSuffix = Test-ComputerNameHasDnsSuffix -ComputerName $ComputerName | ||
|
||
if ($computerNameHasDNSSuffix -eq $true) |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicit comparison with $true
is unnecessary in PowerShell. The variable $computerNameHasDNSSuffix
can be used directly in the if statement: if ($computerNameHasDNSSuffix)
. This is more idiomatic PowerShell and achieves the same result.
if ($computerNameHasDNSSuffix -eq $true) | |
if ($computerNameHasDNSSuffix) |
Copilot uses AI. Check for mistakes.
if (Test-ComputerNameHasDnsSuffix -ComputerName $ComputerName) | ||
$computerNameHasDNSSuffix = Test-ComputerNameHasDnsSuffix -ComputerName $ComputerName | ||
|
||
if ($computerNameHasDNSSuffix -eq $true) |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicit comparison with $true
is unnecessary in PowerShell. The variable $computerNameHasDNSSuffix
can be used directly in the if statement: if ($computerNameHasDNSSuffix)
. This is more idiomatic PowerShell and achieves the same result.
if ($computerNameHasDNSSuffix -eq $true) | |
if ($computerNameHasDNSSuffix) |
Copilot uses AI. Check for mistakes.
{ | ||
if (Test-ComputerNameHasDnsSuffix -ComputerName $ComputerName) | ||
$computerNameHasDNSSuffix = Test-ComputerNameHasDnsSuffix -ComputerName $ComputerName | ||
|
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: this line has extra whitespace that doesn't match the surrounding code formatting.
Copilot uses AI. Check for mistakes.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Description
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.md
and reviewed the following information:ChangeLog.md
file(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
.## Upcoming Release
header in the past tense.ChangeLog.md
if no new release is required, such as fixing test case only.