marking all warnings (#6642)

This commit is contained in:
Clint Rutkas
2020-09-16 12:23:50 -07:00
committed by GitHub
parent dc284d9cbb
commit b0f0940534
4 changed files with 17 additions and 7 deletions

View File

@@ -14,6 +14,8 @@ namespace Microsoft.PowerToys.Telemetry.Events
[EventData] [EventData]
public class EventBase public class EventBase
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Part of telem, can't adjust")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Part of telem, can't adjust")]
public bool UTCReplace_AppSessionGuid => true; public bool UTCReplace_AppSessionGuid => true;
private string _version; private string _version;
@@ -31,11 +33,12 @@ namespace Microsoft.PowerToys.Telemetry.Events
} }
} }
private string GetVersionFromAssembly() private static string GetVersionFromAssembly()
{ {
// For consistency this should be formatted the same way as // For consistency this should be formatted the same way as
// https://github.com/microsoft/PowerToys/blob/710f92d99965109fd788d85ebf8b6b9e0ba1524a/src/common/common.cpp#L635 // https://github.com/microsoft/PowerToys/blob/710f92d99965109fd788d85ebf8b6b9e0ba1524a/src/common/common.cpp#L635
var version = Assembly.GetExecutingAssembly()?.GetName()?.Version ?? new Version(); var version = Assembly.GetExecutingAssembly()?.GetName()?.Version ?? new Version();
return $"v{version.Major}.{version.Minor}.{version.Build}"; return $"v{version.Major}.{version.Minor}.{version.Build}";
} }
} }

View File

@@ -6,6 +6,7 @@ namespace Microsoft.PowerToys.Telemetry.Events
{ {
public interface IEvent public interface IEvent
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Part of telem, can't adjust")]
PartA_PrivTags PartA_PrivTags { get; } PartA_PrivTags PartA_PrivTags { get; }
} }
} }

View File

@@ -32,6 +32,12 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\..\..\codeAnalysis\GlobalSuppressions.cs"> <Compile Include="..\..\..\codeAnalysis\GlobalSuppressions.cs">
<Link>GlobalSuppressions.cs</Link> <Link>GlobalSuppressions.cs</Link>

View File

@@ -9,6 +9,10 @@ namespace Microsoft.PowerToys.Telemetry
/// <summary> /// <summary>
/// Privacy Tag values /// Privacy Tag values
/// </summary> /// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1028:Enum Storage should be Int32", Justification = "Part of telem, can't adjust")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1069:Enums values should not be duplicated", Justification = "Part of telem, gets overwritten by build farm")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Part of telem, can't adjust")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "Part of telem, can't adjust")]
public enum PartA_PrivTags public enum PartA_PrivTags
: ulong : ulong
{ {
@@ -46,12 +50,8 @@ namespace Microsoft.PowerToys.Telemetry
/// Initializes a new instance of the <see cref="TelemetryBase"/> class. /// Initializes a new instance of the <see cref="TelemetryBase"/> class.
/// </summary> /// </summary>
/// <param name="eventSourceName">.</param> /// <param name="eventSourceName">.</param>
public TelemetryBase( public TelemetryBase(string eventSourceName)
string eventSourceName) : base(eventSourceName, EventSourceSettings.EtwSelfDescribingEventFormat, PowerToysTelemetryTraits)
: base(
eventSourceName,
EventSourceSettings.EtwSelfDescribingEventFormat,
PowerToysTelemetryTraits)
{ {
return; return;
} }