Skip to content

Commit

Permalink
Enable SDK Client analyzers for Storage (Azure#7067)
Browse files Browse the repository at this point in the history
Some of these are still blocked by Azure/azure-sdk-tools#127
  • Loading branch information
tg-msft authored Aug 1, 2019
1 parent 665aed9 commit f31a811
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 6 additions & 0 deletions sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ protected virtual BlobBaseClient WithSnapshotImpl(string snapshot)
/// A <see cref="StorageRequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
#pragma warning disable AZC0002 // Client method should have cancellationToken as the last optional parameter
public virtual Response<BlobDownloadInfo> Download() =>
this.Download(CancellationToken.None);
#pragma warning restore AZC0002 // Client method should have cancellationToken as the last optional parameter

/// <summary>
/// The <see cref="DownloadAsync()"/> operation downloads a blob from
Expand All @@ -297,8 +299,10 @@ public virtual Response<BlobDownloadInfo> Download() =>
/// A <see cref="StorageRequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
#pragma warning disable AZC0002 // Client method should have cancellationToken as the last optional parameter
public virtual async Task<Response<BlobDownloadInfo>> DownloadAsync() =>
await this.DownloadAsync(CancellationToken.None).ConfigureAwait(false);
#pragma warning restore AZC0002 // Client method should have cancellationToken as the last optional parameter

/// <summary>
/// The <see cref="Download(CancellationToken)"/> operation downloads
Expand Down Expand Up @@ -345,12 +349,14 @@ public virtual Response<BlobDownloadInfo> Download(
/// A <see cref="StorageRequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
#pragma warning disable AZC0002 // Client method should have cancellationToken as the last optional parameter
public virtual async Task<Response<BlobDownloadInfo>> DownloadAsync(
CancellationToken cancellationToken) =>
await this.DownloadAsync(
accessConditions: default, // Pass anything else so we don't recurse on this overload
cancellationToken: cancellationToken)
.ConfigureAwait(false);
#pragma warning restore AZC0002 // Client method should have cancellationToken as the last optional parameter

/// <summary>
/// The <see cref="Download(HttpRange, BlobAccessConditions?, Boolean, CancellationToken)"/>
Expand Down
8 changes: 8 additions & 0 deletions sdk/storage/Azure.Storage.Blobs/src/BlobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ internal BlobClient(Uri blobUri, HttpPipeline pipeline)
/// a failure occurs.
/// </remarks>
[ForwardsClientCalls]
#pragma warning disable AZC0002 // Client method should have cancellationToken as the last optional parameter
public virtual Response<BlobContentInfo> Upload(Stream content) =>
this.Upload(content, CancellationToken.None);
#pragma warning restore AZC0002 // Client method should have cancellationToken as the last optional parameter

/// <summary>
/// The <see cref="UploadAsync(Stream)"/> operation creates a new block blob
Expand All @@ -216,8 +218,10 @@ public virtual Response<BlobContentInfo> Upload(Stream content) =>
/// a failure occurs.
/// </remarks>
[ForwardsClientCalls]
#pragma warning disable AZC0002 // Client method should have cancellationToken as the last optional parameter
public virtual async Task<Response<BlobContentInfo>> UploadAsync(Stream content) =>
await this.UploadAsync(content, CancellationToken.None).ConfigureAwait(false);
#pragma warning restore AZC0002 // Client method should have cancellationToken as the last optional parameter

/// <summary>
/// The <see cref="Upload(Stream, CancellationToken)"/> operation
Expand Down Expand Up @@ -248,13 +252,15 @@ public virtual async Task<Response<BlobContentInfo>> UploadAsync(Stream content)
/// a failure occurs.
/// </remarks>
[ForwardsClientCalls]
#pragma warning disable AZC0002 // Client method should have cancellationToken as the last optional parameter
public virtual Response<BlobContentInfo> Upload(
Stream content,
CancellationToken cancellationToken) =>
this.Upload(
content,
blobAccessConditions: default, // Pass anything else so we don't recurse on this overload
cancellationToken: cancellationToken);
#pragma warning restore AZC0002 // Client method should have cancellationToken as the last optional parameter

/// <summary>
/// The <see cref="UploadAsync(Stream, CancellationToken)"/> operation
Expand Down Expand Up @@ -285,6 +291,7 @@ public virtual Response<BlobContentInfo> Upload(
/// a failure occurs.
/// </remarks>
[ForwardsClientCalls]
#pragma warning disable AZC0002 // Client method should have cancellationToken as the last optional parameter
public virtual async Task<Response<BlobContentInfo>> UploadAsync(
Stream content,
CancellationToken cancellationToken) =>
Expand All @@ -293,6 +300,7 @@ await this.UploadAsync(
blobAccessConditions: default, // Pass anything else so we don't recurse on this overload
cancellationToken: cancellationToken)
.ConfigureAwait(false);
#pragma warning restore AZC0002 // Client method should have cancellationToken as the last optional parameter

/// <summary>
/// The <see cref="Upload(Stream, BlobHttpHeaders?, Metadata, BlobAccessConditions?, IProgress{StorageProgress}, CancellationToken)"/>
Expand Down
7 changes: 2 additions & 5 deletions sdk/storage/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@
<VersionPrefix>12.0.0</VersionPrefix>

<!--
The Client SDK Analyzers are based on Design Guidelines that haven't been
disable some of them
These analyzers are blocked by https://github.com/Azure/azure-sdk-tools/issues/127
-->
<NoWarn>
$(NoWarn);
AZC0001;
AZC0002;
AZC0007;
AZC0006;
AZC0007;
</NoWarn>

<!--
Expand Down

0 comments on commit f31a811

Please sign in to comment.