Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Commit 41d66c0

Browse files
committed
Add NoCodeFixAttribute
1 parent d289209 commit 41d66c0

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

AsyncUsageAnalyzers/AsyncUsageAnalyzers/AsyncUsageAnalyzers.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<Compile Include="AnalyzerConstants.cs" />
4646
<Compile Include="AnalyzerExtensions.cs" />
4747
<Compile Include="GeneratedCodeAnalysisExtensions.cs" />
48+
<Compile Include="NoCodeFixAttribute.cs" />
4849
<Compile Include="Properties\AssemblyInfo.cs" />
4950
<Compile Include="Resources.Designer.cs">
5051
<AutoGen>True</AutoGen>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace AsyncUsageAnalyzers
2+
{
3+
using System;
4+
using Microsoft.CodeAnalysis.Diagnostics;
5+
6+
/// <summary>
7+
/// This attribute is applied to <see cref="DiagnosticAnalyzer"/>'s if will not get a code fix.
8+
/// Reasons for this would be:
9+
/// <list type="bullet">
10+
/// <item>Visual Studio provides a built-in code fix.</item>
11+
/// <item>A code fix could not provide a useful solution.</item>
12+
/// </list>
13+
/// The reason should be provided.
14+
/// </summary>
15+
[AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
16+
public sealed class NoCodeFixAttribute : System.Attribute
17+
{
18+
private readonly string reason;
19+
20+
/// <summary>
21+
/// Initializes a new instance of the <see cref="NoCodeFixAttribute"/> class.
22+
/// </summary>
23+
/// <param name="reason">The reason why the <see cref="DiagnosticAnalyzer"/> does not have a code fix.</param>
24+
public NoCodeFixAttribute(string reason)
25+
{
26+
this.reason = reason;
27+
}
28+
29+
/// <summary>
30+
/// Gets the reason why the <see cref="DiagnosticAnalyzer"/> does not have a code fix.
31+
/// </summary>
32+
/// <value>
33+
/// The reason why the <see cref="DiagnosticAnalyzer"/> does not have a code fix.
34+
/// </value>
35+
public string Reason
36+
{
37+
get { return this.reason; }
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)