Skip to content
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

Fixes #10633 - multiple statements simplified by removing explicit comparison #10698

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

robbyc073
Copy link

Summary

Multiple if and while statements simplified by removing explicit comparison and replacing with logical NOT operator as required.

Fixes #10633

@robbyc073 robbyc073 requested a review from a team as a code owner November 20, 2024 22:28
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Nov 20, 2024
@robbyc073
Copy link
Author

@dotnet-policy-bot agree

@robbyc073
Copy link
Author

@dotnet-policy-service agree

Copy link

Learn Build status updates of commit 9d92d19:

✅ Validation status: passed

File Status Preview URL Details
snippets/common/VS_Snippets_WebNet/Classic RequiredFieldValidator Example/Common/source.xml ✅Succeeded View
snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp ✅Succeeded View

This comment lists only the first 25 files in the pull request.
For more details, please refer to the build report.

For any questions, please:

Copy link
Contributor

@gewarren gewarren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - a few things to fix before we can merge.

@@ -76,7 +76,7 @@ int main(array<String^>^ args)
String^ answer = Console::ReadLine();
// If the user canceled the send, and mail hasn't been
// sent yet,then cancel the pending operation.
if (answer->ToLower()->StartsWith("c") && mailSent == false)
if (!answer->ToLower()->StartsWith("c") && mailSent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!answer->ToLower()->StartsWith("c") && mailSent)
if (!(answer->ToLower()->StartsWith("c") && mailSent))

@@ -2269,7 +2269,7 @@ jQuery.event = {
elem = window;
}

if ( handler === false ) {
if (! handler) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (! handler) {
if (!handler) {

@@ -2416,7 +2416,7 @@ jQuery.event = {
return;
}

if ( handler === false ) {
if (! handler) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (! handler) {
if (!handler) {

@@ -2713,7 +2713,7 @@ jQuery.event = {

if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
if (! ret) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (! ret) {
if (!ret) {

maxLevel = match.level;

if ( ret === false ) {
if (! ret) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (! ret) {
if (!ret) {

@@ -6714,7 +6714,7 @@ jQuery.extend({
}

// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
if ( s.data && s.hasContent && !s.contentType || options.contentType ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( s.data && s.hasContent && !s.contentType || options.contentType ) {
if ( s.data && s.hasContent && s.contentType || options.contentType ) {

@@ -7051,7 +7051,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
if ( s.dataTypes[ 0 ] === "jsonp" ||
originalSettings.jsonpCallback ||
originalSettings.jsonp != null ||
s.jsonp !== false && ( jsre.test( s.url ) ||
!s.jsonp && ( jsre.test( s.url ) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!s.jsonp && ( jsre.test( s.url ) ||
s.jsonp && ( jsre.test( s.url ) ||

@@ -3459,7 +3459,7 @@ $.widget("ui.sortable", $.ui.mouse, {

}

if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
if(!scrolled && $.ui.ddmanager && !o.dropBehaviour)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(!scrolled && $.ui.ddmanager && !o.dropBehaviour)
if(scrolled && $.ui.ddmanager && !o.dropBehaviour)

@@ -5168,7 +5168,7 @@ $.widget( "ui.autocomplete", {
}

clearTimeout( this.closing );
if ( this._trigger( "search", event ) === false ) {
if (! this._trigger( "search", event )) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (! this._trigger( "search", event )) {
if (!this._trigger( "search", event )) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also remove the other spaces like this in this file?

@@ -309,7 +309,7 @@ Sys.Mvc.MvcHelpers._onComplete = function Sys_Mvc_MvcHelpers$_onComplete(request
/// <param name="ajaxContext" type="Sys.Mvc.AjaxContext">
/// </param>
ajaxContext.set_response(request.get_executor());
if (ajaxOptions.onComplete && ajaxOptions.onComplete(ajaxContext) === false) {
if (!ajaxOptions.onComplete && ajaxOptions.onComplete(ajaxContext)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!ajaxOptions.onComplete && ajaxOptions.onComplete(ajaxContext)) {
if (!(ajaxOptions.onComplete && ajaxOptions.onComplete(ajaxContext))) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Infrastructure community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poor (beginner) if statements
2 participants