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

Enable SDK Client analyzer rules for Storage #7067

Merged
merged 1 commit into from
Aug 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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