From d14053e420c318b78a1d99641d34af7b515a5b67 Mon Sep 17 00:00:00 2001 From: Enji Eid Date: Fri, 12 Jul 2024 15:43:43 +0200 Subject: [PATCH 1/2] MSTEST0032 Analyzer (#41732) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: David Pine Co-authored-by: Amaury Levé --- .../testing/mstest-analyzers/mstest0032.md | 40 +++++++++++++++++++ docs/navigate/devops-testing/toc.yml | 2 + 2 files changed, 42 insertions(+) create mode 100644 docs/core/testing/mstest-analyzers/mstest0032.md diff --git a/docs/core/testing/mstest-analyzers/mstest0032.md b/docs/core/testing/mstest-analyzers/mstest0032.md new file mode 100644 index 0000000000000..20ce96251385b --- /dev/null +++ b/docs/core/testing/mstest-analyzers/mstest0032.md @@ -0,0 +1,40 @@ +--- +title: "MSTEST0032: Review or remove the assertion as its condition is known to be always true." +description: "Learn about code analysis rule MSTEST0032: Review or remove the assertion as its condition is known to be always true." +ms.date: 07/11/2024 +f1_keywords: +- MSTEST0032 +- ReviewAlwaysTrueAssertConditionAnalyzer +helpviewer_keywords: +- ReviewAlwaysTrueAssertConditionAnalyzer +- MSTEST0032 +author: engyebrahim +ms.author: enjieid +--- +# MSTEST0032: Review or remove the assertion as its condition is known to be always true. + +| Property | Value | +|-------------------------------------|-----------------------------------------------------------------------------| +| **Rule ID** | MSTEST0032 | +| **Title** | Review or remove the assertion as its condition is known to be always true. | +| **Category** | Usage | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default** | Yes | +| **Default severity** | Info | +| **Introduced in version** | 3.5.0 | + +## Cause + +This rule raises a diagnostic when a call to an assertion produces an always-true condition. + +## Rule description + +When you encounter an assertion that always passes (for example, `Assert.IsTrue(true)`), it's not obvious to someone reading the code why the assertion is there or what condition it's trying to check. This can lead to confusion and wasted time for developers who come across the code later on. + +## How to fix violations + +Ensure that calls to `Assert.IsTrue`, `Assert.IsFalse`, `Assert.AreEqual`, `Assert.AreNotEqual`, `Assert.IsNull` or `Assert.IsNotNull` aren't producing always-true conditions. + +## When to suppress warnings + +It's _not_ recommended to suppress warnings from this rule. diff --git a/docs/navigate/devops-testing/toc.yml b/docs/navigate/devops-testing/toc.yml index 81c46cd43cf37..8246f24c8bebe 100644 --- a/docs/navigate/devops-testing/toc.yml +++ b/docs/navigate/devops-testing/toc.yml @@ -147,6 +147,8 @@ items: href: ../../core/testing/mstest-analyzers/mstest0030.md - name: MSTEST0031 href: ../../core/testing/mstest-analyzers/mstest0031.md + - name: MSTEST0032 + href: ../../core/testing/mstest-analyzers/mstest0032.md - name: Microsoft Testing Platform items: - name: Overview From 9cfd224227785a85ff5f4bf728677ff7fcff8b15 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 12 Jul 2024 19:20:48 -0400 Subject: [PATCH 2/2] Update package index with latest published versions (#41747) --- docs/azure/includes/dotnet-all.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 900d8be855fc0..24e456045fc42 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -455,7 +455,7 @@ | Functions extension for RabbitMQ | NuGet [2.0.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.RabbitMQ/2.0.3) | | GitHub [2.0.3](https://github.com/Azure/azure-functions-rabbitmq-extension/tree/v0.2.2029-beta) | | Functions extension for script abstractions | NuGet [1.0.4-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Script.Abstractions/1.0.4-preview) | | | | Functions extension for SendGrid | NuGet [3.0.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.SendGrid/3.0.3) | | GitHub [3.0.3](https://github.com/Azure/azure-webjobs-sdk-extensions/tree/v3.0.0/src/WebJobs.Extensions.SendGrid) | -| Functions extension for Sources | NuGet [3.0.39](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Sources/3.0.39) | | GitHub [3.0.39](https://github.com/Azure/azure-webjobs-sdk) | +| Functions extension for Sources | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Sources/3.0.41) | | GitHub [3.0.41](https://github.com/Azure/azure-webjobs-sdk) | | Functions extension for Storage Queues | NuGet [5.3.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/5.3.0) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.Storage.Queues-readme) | | | Functions extension for Storage Timers | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Timers.Storage/1.0.0) | | | | Functions extension for Twilio | NuGet [3.0.2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Twilio/3.0.2) | | GitHub [3.0.2](https://github.com/Azure/azure-webjobs-sdk-extensions/tree/v3.0.0/src/WebJobs.Extensions.Twilio) | @@ -472,9 +472,9 @@ | Functions OpenAPI app settings deserialization library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/1.4.0)
NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/2.0.0-preview2) | | | | Functions OpenAPI document and Swagger UI renderer library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/1.4.0)
NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/2.0.0-preview2) | | | | Functions project template pack for Microsoft Template Engine | NuGet [4.0.3038](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ProjectTemplates/4.0.3038) | | GitHub [4.0.3038](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) | -| Functions runtime assemblies for App Insights logging | NuGet [3.0.35](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/3.0.35) | | GitHub [3.0.35](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights) | +| Functions runtime assemblies for App Insights logging | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/3.0.41) | | GitHub [3.0.41](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights) | | Functions runtime assemblies for logging | NuGet [4.0.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging/4.0.3) | | GitHub [4.0.3](https://github.com/Azure/azure-webjobs-sdk/tree/dev/src/Microsoft.Azure.WebJobs.Logging) | -| Functions runtime assemblies for Microsoft.Azure.WebJobs.Host | NuGet [3.0.39](https://www.nuget.org/packages/Microsoft.Azure.WebJobs/3.0.39) | | GitHub [3.0.39](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs) | +| Functions runtime assemblies for Microsoft.Azure.WebJobs.Host | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs/3.0.41) | | GitHub [3.0.41](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs) | | Functions timers and file triggers | NuGet [5.0.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions/5.0.0) | | GitHub [5.0.0](https://github.com/Azure/azure-webjobs-sdk-extensions/tree/dev/src/WebJobs.Extensions) | | Microsoft.Azure.Cosmos.Templates | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Templates/1.0.0) | | | | Microsoft.Azure.Functions.Analyzers | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Analyzers/1.0.0) | | | @@ -513,8 +513,8 @@ | Microsoft.Azure.WebJobs.CosmosDb.ChangeProcessor | NuGet [1.0.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.CosmosDb.ChangeProcessor/1.0.4) | | | | Microsoft.Azure.WebJobs.CosmosDb.Mongo | NuGet [1.0.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.CosmosDb.Mongo/1.0.4) | | | | Microsoft.Azure.WebJobs.Extensions.Kusto | NuGet [1.0.10-Preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Kusto/1.0.10-Preview) | | | -| Microsoft.Azure.WebJobs.Extensions.Rpc | NuGet [3.0.39](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Rpc/3.0.39) | | | -| Microsoft.Azure.WebJobs.Rpc.Core | NuGet [3.0.39](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Rpc.Core/3.0.39) | | | +| Microsoft.Azure.WebJobs.Extensions.Rpc | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Rpc/3.0.41) | | | +| Microsoft.Azure.WebJobs.Rpc.Core | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Rpc.Core/3.0.41) | | | | Service Bus - Message ID plugin | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.ServiceBus.MessageIdPlugin/2.0.0) | | | | SignalR | NuGet [1.26.0](https://www.nuget.org/packages/Microsoft.Azure.SignalR/1.26.0)
NuGet [1.25.0-preview1-11147](https://www.nuget.org/packages/Microsoft.Azure.SignalR/1.25.0-preview1-11147) | | GitHub [1.26.0](https://github.com/Azure/azure-signalr/tree/v1.5.0/src/Microsoft.Azure.SignalR) | | SignalR - ASP.NET | NuGet [1.26.0](https://www.nuget.org/packages/Microsoft.Azure.SignalR.AspNet/1.26.0) | | GitHub [1.26.0](https://github.com/Azure/azure-signalr/tree/v1.5.0/src/Microsoft.Azure.SignalR.AspNet) | @@ -525,10 +525,10 @@ | SQL Database Elastic Scale Client | NuGet [2.4.1](https://www.nuget.org/packages/Microsoft.Azure.SqlDatabase.ElasticScale.Client/2.4.1)
NuGet [2.4.2-preview1](https://www.nuget.org/packages/Microsoft.Azure.SqlDatabase.ElasticScale.Client/2.4.2-preview1) | | GitHub [2.4.1](https://github.com/Azure/elastic-db-tools/tree/v2.3.0/Src/ElasticScale.Client) | | SQL Database Elastic Scale Service SplitMerge | NuGet [1.2.0](https://www.nuget.org/packages/Microsoft.Azure.SqlDatabase.ElasticScale.Service.SplitMerge/1.2.0) | | | | SQL Database Jobs | NuGet [0.8.3362.1](https://www.nuget.org/packages/Microsoft.Azure.SqlDatabase.Jobs/0.8.3362.1) | | | -| Storage APIs for Microsoft.Azure.WebJobs.Host | NuGet [5.0.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Host.Storage/5.0.0) | | GitHub [5.0.0](https://github.com/Azure/azure-webjobs-sdk/tree/storage-v4.0.1/src/Microsoft.Azure.WebJobs.Host.Storage) | -| Supporting library for Microsoft.Azure.WebJobs | NuGet [3.0.39](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Core/3.0.39) | | GitHub [3.0.39](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18) | +| Storage APIs for Microsoft.Azure.WebJobs.Host | NuGet [5.0.1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Host.Storage/5.0.1) | | GitHub [5.0.1](https://github.com/Azure/azure-webjobs-sdk/tree/storage-v4.0.1/src/Microsoft.Azure.WebJobs.Host.Storage) | +| Supporting library for Microsoft.Azure.WebJobs | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Core/3.0.41) | | GitHub [3.0.41](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18) | | Supporting library for Microsoft.Azure.WebJobs.Extensions.OpenApi | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/1.4.0)
NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/2.0.0-preview2) | | | -| Supporting library for testing Microsoft.Azure.WebJobs.Host | NuGet [3.0.39](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Host.TestCommon/3.0.39) | | GitHub [3.0.39](https://github.com/Azure/azure-webjobs-sdk) | +| Supporting library for testing Microsoft.Azure.WebJobs.Host | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Host.TestCommon/3.0.41) | | GitHub [3.0.41](https://github.com/Azure/azure-webjobs-sdk) | | Web - Redis Output Cache Provider | NuGet [4.0.1](https://www.nuget.org/packages/Microsoft.Web.RedisOutputCacheProvider/4.0.1) | | GitHub [4.0.1](https://github.com/Azure/aspnet-redis-providers/tree/NuGet-Release/RedisOutputCacheProvider-3.0.1/src/OutputCacheProvider) | | Web - Redis Session State Provider | NuGet [5.0.4](https://www.nuget.org/packages/Microsoft.Web.RedisSessionStateProvider/5.0.4) | | GitHub [5.0.4](https://github.com/Azure/aspnet-redis-providers/tree/NuGet-Release/RedisSessionStateProvider-4.0.1/src/RedisSessionStateProvider) | | Hyak Common | NuGet [1.2.2](https://www.nuget.org/packages/Hyak.Common/1.2.2) | | |