From a6d58cf98b8f80e1f2f2d09f87e0af2753771402 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 2 Jun 2020 11:29:32 -0700 Subject: [PATCH] Enable return type and banned assembly analyzers (#12418) --- eng/Packages.Data.props | 2 +- .../src/Properties/AssemblyInfo.cs | 4 ++++ .../src/Properties/AssemblyInfo.cs | 1 + .../src/Properties/AssemblyInfo.cs | 1 + .../src/Properties/AssemblyInfo.cs | 5 ++++- .../src/Properties/AssemblyInfo.cs | 1 + sdk/storage/Azure.Storage.Blobs.Batch/src/AssemblyInfo.cs | 4 +++- .../Azure.Storage.Files.Shares/src/AssemblyInfo.cs | 8 +++++++- 8 files changed, 22 insertions(+), 4 deletions(-) diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index e0cda5e3bf86..c673e8d70792 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -123,7 +123,7 @@ - + diff --git a/sdk/core/Azure.Core.Experimental/src/Properties/AssemblyInfo.cs b/sdk/core/Azure.Core.Experimental/src/Properties/AssemblyInfo.cs index d425518410eb..d1b4276e7acf 100644 --- a/sdk/core/Azure.Core.Experimental/src/Properties/AssemblyInfo.cs +++ b/sdk/core/Azure.Core.Experimental/src/Properties/AssemblyInfo.cs @@ -1,6 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Azure.Core.Experimental.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +[assembly: SuppressMessage("Usage", "AZC0014:Avoid using banned types in public API", Justification = "Azure.Core.Experimental ships adapters for System.Text.Json", Scope = "type", Target = "~T:Azure.Core.JsonObjectSerializer")] +[assembly: SuppressMessage("Usage", "AZC0014:Avoid using banned types in public API", Justification = "Azure.Core.Experimental ships adapters for System.Text.Json", Scope = "type", Target = "~T:Azure.Core.Spatial.GeometryJsonConverter")] diff --git a/sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/Properties/AssemblyInfo.cs b/sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/Properties/AssemblyInfo.cs index 19bdbd638c94..a8d20fb985d7 100755 --- a/sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/Properties/AssemblyInfo.cs +++ b/sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/Properties/AssemblyInfo.cs @@ -10,3 +10,4 @@ [assembly: SuppressMessage("Usage", "AZC0004:DO provide both asynchronous and synchronous variants for all service methods.", Justification = "As an AMQP-based offering, Event Hubs has been exempted from providing a synchronous surface.")] [assembly: SuppressMessage("Usage", "AZC0008:ClientOptions should have a nested enum called ServiceVersion", Justification = "The Event Hubs interface does not support the concept of versions.")] [assembly: SuppressMessage("Usage", "AZC0006:DO provide constructor overloads that allow specifying additional options.", Justification = "Analysis is flagging incorrectly. The Event Hubs constructor patterns adhere to guidance and have obtained board approval.")] +[assembly: SuppressMessage("Usage", "AZC0015:Unexpected client method return type.", Justification = "As an AMQP-based offering, Event Hubs has been exempted from HTTP-based return types.")] diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/src/Properties/AssemblyInfo.cs b/sdk/eventhub/Azure.Messaging.EventHubs/src/Properties/AssemblyInfo.cs index 065eec7f89c1..e202a207fc40 100755 --- a/sdk/eventhub/Azure.Messaging.EventHubs/src/Properties/AssemblyInfo.cs +++ b/sdk/eventhub/Azure.Messaging.EventHubs/src/Properties/AssemblyInfo.cs @@ -10,3 +10,4 @@ [assembly: SuppressMessage("Usage", "AZC0004:DO provide both asynchronous and synchronous variants for all service methods.", Justification = "As an AMQP-based offering, Event Hubs has been exempted from providing a synchronous surface.")] [assembly: SuppressMessage("Usage", "AZC0008:ClientOptions should have a nested enum called ServiceVersion", Justification = "The Event Hubs interface does not support the concept of versions.")] [assembly: SuppressMessage("Usage", "AZC0006:DO provide constructor overloads that allow specifying additional options.", Justification = "Analysis is flagging incorrectly. The Event Hubs constructor patterns adhere to guidance and have obtained board approval.")] +[assembly: SuppressMessage("Usage", "AZC0015:Unexpected client method return type.", Justification = "As an AMQP-based offering, Event Hubs has been exempted from HTTP-based return types.")] diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Properties/AssemblyInfo.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Properties/AssemblyInfo.cs index 5a4e79767695..5fee7c6a6f74 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Properties/AssemblyInfo.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Properties/AssemblyInfo.cs @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Azure.Security.KeyVault.Keys.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] -[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.KeyVault")] \ No newline at end of file +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.KeyVault")] + +[assembly: SuppressMessage("Usage", "AZC0015:Unexpected client method return type.", Justification = "CryptographyClient processes some of the calls locally without sending HTTP requests.", Scope = "type", Target = "~T:Azure.Security.KeyVault.Keys.Cryptography.CryptographyClient")] diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Properties/AssemblyInfo.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Properties/AssemblyInfo.cs index 273c7846f5ba..836b28449131 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Properties/AssemblyInfo.cs +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Properties/AssemblyInfo.cs @@ -10,3 +10,4 @@ [assembly: SuppressMessage("Usage", "AZC0004:DO provide both asynchronous and synchronous variants for all service methods.", Justification = "As an AMQP-based offering, Service Bus has been exempted from providing a synchronous surface.")] [assembly: SuppressMessage("Usage", "AZC0008:ClientOptions should have a nested enum called ServiceVersion", Justification = "The Service Bus interface does not support the concept of versions.")] [assembly: SuppressMessage("Usage", "AZC0006:DO provide constructor overloads that allow specifying additional options.", Justification = "Analysis is flagging incorrectly. The Service Bus constructor patterns adhere to guidance and have obtained board approval.")] +[assembly: SuppressMessage("Usage", "AZC0015:Unexpected client method return type.", Justification = "As an AMQP-based offering, Service Bus has been exempted from HTTP-based return types.")] diff --git a/sdk/storage/Azure.Storage.Blobs.Batch/src/AssemblyInfo.cs b/sdk/storage/Azure.Storage.Blobs.Batch/src/AssemblyInfo.cs index 9e9f9f15eba7..1e1649787f22 100644 --- a/sdk/storage/Azure.Storage.Blobs.Batch/src/AssemblyInfo.cs +++ b/sdk/storage/Azure.Storage.Blobs.Batch/src/AssemblyInfo.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Azure.Storage.Blobs.Batch.Tests, PublicKey=" + @@ -9,4 +10,5 @@ "012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265" + "e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593d" + "aa7b11b4")] -[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Storage")] \ No newline at end of file +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Storage")] +[assembly: SuppressMessage("Usage", "AZC0015:Unexpected client method return type.", Justification = "Batch client is exempted from normal return type rules.")] diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/AssemblyInfo.cs b/sdk/storage/Azure.Storage.Files.Shares/src/AssemblyInfo.cs index f10621168ea5..cb62432b8f55 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/AssemblyInfo.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/AssemblyInfo.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Azure.Storage.Files.Shares.Tests, PublicKey=" + @@ -10,4 +11,9 @@ "e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593d" + "aa7b11b4")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] -[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Storage")] \ No newline at end of file +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Storage")] + +[assembly: SuppressMessage("Usage", "AZC0015:Unexpected client method return type.", Justification = "Helper method that does multiple requests", Scope = "member", Target = "~M:Azure.Storage.Files.Shares.ShareDirectoryClient.ForceCloseAllHandles(System.Nullable{System.Boolean},System.Threading.CancellationToken)~Azure.Storage.Files.Shares.Models.CloseHandlesResult")] +[assembly: SuppressMessage("Usage", "AZC0015:Unexpected client method return type.", Justification = "Helper method that does multiple requests", Scope = "member", Target = "~M:Azure.Storage.Files.Shares.ShareDirectoryClient.ForceCloseAllHandlesAsync(System.Nullable{System.Boolean},System.Threading.CancellationToken)~System.Threading.Tasks.Task{Azure.Storage.Files.Shares.Models.CloseHandlesResult}")] +[assembly: SuppressMessage("Usage", "AZC0015:Unexpected client method return type.", Justification = "Helper method that does multiple requests", Scope = "member", Target = "~M:Azure.Storage.Files.Shares.ShareFileClient.ForceCloseAllHandles(System.Threading.CancellationToken)~Azure.Storage.Files.Shares.Models.CloseHandlesResult")] +[assembly: SuppressMessage("Usage", "AZC0015:Unexpected client method return type.", Justification = "Helper method that does multiple requests", Scope = "member", Target = "~M:Azure.Storage.Files.Shares.ShareFileClient.ForceCloseAllHandlesAsync(System.Threading.CancellationToken)~System.Threading.Tasks.Task{Azure.Storage.Files.Shares.Models.CloseHandlesResult}")]