Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit ae5962f

Browse files
authored
Merge pull request #2134 from github/fixes/supress-warnings
Suppress CA warnings where it makes sense.
2 parents 3b11ae4 + 58f8370 commit ae5962f

File tree

47 files changed

+156
-30
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+156
-30
lines changed

src/CredentialManagement/NativeMethods.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using System.Text;
55
using Microsoft.Win32.SafeHandles;
66

7+
#pragma warning disable CA1034 // Nested types should not be visible
8+
#pragma warning disable CA1051 // Do not declare visible instance fields
9+
#pragma warning disable CA1707 // Identifiers should not contain underscores
10+
711
namespace GitHub.Authentication.CredentialManagement
812
{
913
public static class NativeMethods
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This file is used by Code Analysis to maintain SuppressMessage
2+
// attributes that are applied to this project.
3+
// Project-level suppressions either have no target or are given
4+
// a specific target and scoped to a namespace, type, member, etc.
5+
6+
using System.Diagnostics.CodeAnalysis;
7+
8+
[assembly: SuppressMessage("Reliability", "CA2007:Do not directly await a Task", Justification = "Discouraged for VSSDK projects.")]
9+

src/GitHub.App/Collections/VirtualizingList.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
using GitHub.Logging;
1313
using Serilog;
1414

15+
#pragma warning disable CA1010 // Collections should implement generic interface
16+
#pragma warning disable CA1033 // Interface methods should be callable by child types
17+
#pragma warning disable CA1710 // Identifiers should have correct suffix
18+
1519
namespace GitHub.Collections
1620
{
1721
/// <summary>

src/GitHub.App/Collections/VirtualizingListCollectionView.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using System.Collections.Specialized;
55
using System.Windows.Data;
66

7+
#pragma warning disable CA1010 // Collections should implement generic interface
8+
#pragma warning disable CA1033 // Interface methods should be callable by child types
9+
#pragma warning disable CA1710 // Identifiers should have correct suffix
10+
711
namespace GitHub.Collections
812
{
913
/// <summary>
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
using System.Diagnostics.CodeAnalysis;
2-
3-
[assembly: SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "GitHub.ViewModels.CreateRepoViewModel.#ResetState()")]
4-
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Git", Scope = "resource", Target = "GitHub.Resources.resources")]
5-
[assembly: SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Scope = "member", Target = "GitHub.Caches.CredentialCache.#InsertObject`1(System.String,!!0,System.Nullable`1<System.DateTimeOffset>)")]
6-
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Git", Scope = "resource", Target = "GitHub.App.Resources.resources")]
7-
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String)")]
8-
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String,System.Text.Encoding)")]
9-
101
// This file is used by Code Analysis to maintain SuppressMessage
112
// attributes that are applied to this project.
123
// Project-level suppressions either have no target or are given
@@ -16,3 +7,13 @@
167
// Code Analysis results, point to "Suppress Message", and click
178
// "In Suppression File".
189
// You do not need to add suppressions to this file manually.
10+
11+
using System.Diagnostics.CodeAnalysis;
12+
13+
[assembly: SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "GitHub.ViewModels.CreateRepoViewModel.#ResetState()")]
14+
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Git", Scope = "resource", Target = "GitHub.Resources.resources")]
15+
[assembly: SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Scope = "member", Target = "GitHub.Caches.CredentialCache.#InsertObject`1(System.String,!!0,System.Nullable`1<System.DateTimeOffset>)")]
16+
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Git", Scope = "resource", Target = "GitHub.App.Resources.resources")]
17+
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String)")]
18+
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String,System.Text.Encoding)")]
19+
[assembly: SuppressMessage("Reliability", "CA2007:Do not directly await a Task", Justification = "Discouraged for VSSDK projects.")]

src/GitHub.App/Services/ErrorMessageTranslator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using ReactiveUI.Legacy;
88

99
#pragma warning disable CS0618 // Type or member is obsolete
10+
#pragma warning disable CA1034 // Nested types should not be visible
1011

1112
namespace GitHub.Services
1213
{

src/GitHub.App/Services/ModelService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
using Serilog;
2323
using static Octokit.GraphQL.Variable;
2424

25+
#pragma warning disable CA1034 // Nested types should not be visible
26+
2527
namespace GitHub.Services
2628
{
2729
[Export(typeof(IModelService))]

src/GitHub.App/sqlite-net/SQLite.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,23 @@
5454
#endif
5555

5656
#pragma warning disable 1591 // XML Doc Comments
57+
#pragma warning disable CA1018 // Mark attributes with AttributeUsageAttribute
58+
#pragma warning disable CA1032 // Implement standard exception constructors
59+
#pragma warning disable CA1034 // Nested types should not be visible
60+
#pragma warning disable CA1051 // Do not declare visible instance fields
61+
#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
62+
#pragma warning disable CA1060 // Move pinvokes to native methods class
63+
#pragma warning disable CA1304 // Specify CultureInfo
64+
#pragma warning disable CA1305 // Specify IFormatProvider
65+
#pragma warning disable CA1401 // P/Invokes should not be visible
66+
#pragma warning disable CA1710 // Identifiers should have correct suffix
67+
#pragma warning disable CA1720 // Identifier contains type name
68+
#pragma warning disable CA1806 // Do not ignore method results
69+
#pragma warning disable CA1819 // Properties should not return arrays
70+
#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments
71+
#pragma warning disable CA2200 // Rethrow to preserve stack details.
72+
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
73+
#pragma warning disable CA2237 // Mark ISerializable types with serializable
5774

5875
namespace SQLite
5976
{

src/GitHub.App/sqlite-net/SQLiteAsync.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
using System.Threading;
2929
using System.Threading.Tasks;
3030

31+
#pragma warning disable CA1001 // Types that own disposable fields should be disposable
32+
#pragma warning disable CA1200 // Avoid using cref tags with a prefix
33+
#pragma warning disable CA1720 // Identifier contains type name
34+
3135
namespace SQLite
3236
{
3337
/// <summary>
-666 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)