Skip to content

Commit b93151c

Browse files
committed
Added FxCop Analyzers
1 parent f82594d commit b93151c

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/Tesla.NET/Models/Internal/Vehicle.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Tesla.NET.Models.Internal
55
{
6+
using System;
67
using System.Collections.Generic;
78
using System.Diagnostics;
89

@@ -12,7 +13,7 @@ namespace Tesla.NET.Models.Internal
1213
[DebuggerDisplay("{DebuggerDisplay,nq}")]
1314
public class Vehicle : IVehicle
1415
{
15-
private static readonly string[] EmptyTokens = { };
16+
private static readonly string[] EmptyTokens = Array.Empty<string>();
1617

1718
/// <summary>
1819
/// Initializes a new instance of the <see cref="Vehicle"/> class.

src/Tesla.NET/Requests/HttpClientExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace Tesla.NET.Requests
55
{
66
using System;
77
using System.Collections.Generic;
8+
using System.Diagnostics.CodeAnalysis;
89
using System.IO;
910
using System.Linq;
1011
using System.Net;
@@ -451,6 +452,10 @@ private static async Task<IMessageResponse<T>> ReadSuccessResponseAsync<T>(
451452
/// <param name="cancellationToken">A <see cref="CancellationToken" /> to observe while waiting for a task to
452453
/// complete.</param>
453454
/// <returns>The <see cref="IMessageResponse{T}"/>.</returns>
455+
[SuppressMessage(
456+
"Design",
457+
"CA1031:Do not catch general exception types",
458+
Justification = "Exception swallowed to return error code.")]
454459
private static async Task<IMessageResponse<T>> ReadFailureResponseAsync<T>(
455460
this HttpResponseMessage responseMessage,
456461
CancellationToken cancellationToken)

src/Tesla.NET/Tesla.NET.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
</PropertyGroup>
2929

3030
<ItemGroup>
31+
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
32+
<PrivateAssets>all</PrivateAssets>
33+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
34+
</PackageReference>
3135
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
3236
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164">
3337
<PrivateAssets>all</PrivateAssets>

0 commit comments

Comments
 (0)