Skip to content

Commit 636db09

Browse files
committed
Rename ASP006ParameterRegex
1 parent 0685e3e commit 636db09

9 files changed

Lines changed: 84 additions & 17 deletions

File tree

AspNetCoreAnalyzers.Tests/ASP005ParameterRegexTests/CodeFix.cs renamed to AspNetCoreAnalyzers.Tests/ASP006ParameterRegexTests/CodeFix.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace AspNetCoreAnalyzers.Tests.ASP005ParameterRegexTests
1+
namespace AspNetCoreAnalyzers.Tests.ASP006ParameterRegexTests
22
{
33
using Gu.Roslyn.Asserts;
44
using Microsoft.CodeAnalysis.CodeFixes;
@@ -8,7 +8,7 @@ namespace AspNetCoreAnalyzers.Tests.ASP005ParameterRegexTests
88
public class CodeFix
99
{
1010
private static readonly DiagnosticAnalyzer Analyzer = new AttributeAnalyzer();
11-
private static readonly ExpectedDiagnostic ExpectedDiagnostic = ExpectedDiagnostic.Create(ASP005ParameterRegex.Descriptor);
11+
private static readonly ExpectedDiagnostic ExpectedDiagnostic = ExpectedDiagnostic.Create(ASP006ParameterRegex.Descriptor);
1212
private static readonly CodeFixProvider Fix = new TemplateTextFix();
1313

1414
[TestCase("\"api/orders/{id:regex(↓a{1})}\"", "\"api/orders/{id:regex(a{{1}})}\"")]

AspNetCoreAnalyzers.Tests/ASP005ParameterRegexTests/ValidCode.cs renamed to AspNetCoreAnalyzers.Tests/ASP006ParameterRegexTests/ValidCode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace AspNetCoreAnalyzers.Tests.ASP005ParameterRegexTests
1+
namespace AspNetCoreAnalyzers.Tests.ASP006ParameterRegexTests
22
{
33
using Gu.Roslyn.Asserts;
44
using Microsoft.CodeAnalysis.Diagnostics;

AspNetCoreAnalyzers.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".docs", ".docs", "{1C271AF2
3333
documentation\ASP002.md = documentation\ASP002.md
3434
documentation\ASP003.md = documentation\ASP003.md
3535
documentation\ASP004.md = documentation\ASP004.md
36-
documentation\ASP005.md = documentation\ASP005.md
36+
documentation\ASP006.md = documentation\ASP006.md
3737
README.md = README.md
3838
RELEASE_NOTES.md = RELEASE_NOTES.md
3939
EndProjectSection

AspNetCoreAnalyzers/ASP005ParameterRegex.cs renamed to AspNetCoreAnalyzers/ASP006ParameterRegex.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ namespace AspNetCoreAnalyzers
55
/// <summary>
66
/// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-2.2#regular-expressions
77
/// </summary>
8-
internal static class ASP005ParameterRegex
8+
internal static class ASP006ParameterRegex
99
{
10-
public const string DiagnosticId = "ASP005";
10+
public const string DiagnosticId = "ASP006";
1111

1212
internal static readonly DiagnosticDescriptor Descriptor = new DiagnosticDescriptor(
1313
id: DiagnosticId,

AspNetCoreAnalyzers/Analyzers/AttributeAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class AttributeAnalyzer : DiagnosticAnalyzer
1919
ASP002MissingParameter.Descriptor,
2020
ASP003ParameterType.Descriptor,
2121
ASP004ParameterSyntax.Descriptor,
22-
ASP005ParameterRegex.Descriptor);
22+
ASP006ParameterRegex.Descriptor);
2323

2424
public override void Initialize(AnalysisContext context)
2525
{
@@ -109,7 +109,7 @@ context.ContainingSymbol is IMethodSymbol method &&
109109
{
110110
context.ReportDiagnostic(
111111
Diagnostic.Create(
112-
ASP005ParameterRegex.Descriptor,
112+
ASP006ParameterRegex.Descriptor,
113113
location,
114114
syntax == null
115115
? ImmutableDictionary<string, string>.Empty

AspNetCoreAnalyzers/CodeFixes/TemplateTextFix.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class TemplateTextFix : CodeFixProvider
1818
public override ImmutableArray<string> FixableDiagnosticIds { get; } = ImmutableArray.Create(
1919
ASP002MissingParameter.DiagnosticId,
2020
ASP004ParameterSyntax.DiagnosticId,
21-
ASP005ParameterRegex.DiagnosticId);
21+
ASP006ParameterRegex.DiagnosticId);
2222

2323
public override FixAllProvider GetFixAllProvider() => null;
2424

@@ -57,7 +57,7 @@ private static string GetTitle(Diagnostic diagnostic)
5757
return "Rename parameter";
5858
case ASP004ParameterSyntax.DiagnosticId:
5959
return "Fix syntax error.";
60-
case ASP005ParameterRegex.DiagnosticId:
60+
case ASP006ParameterRegex.DiagnosticId:
6161
return "Escape regex.";
6262
default:
6363
throw new InvalidOperationException("Should never get here.");

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Roslyn analyzers for ASP.NET.Core.
2727
<td>Syntax error in parameter.</td>
2828
</tr>
2929
<tr>
30-
<td><a href="https://github.com/DotNetAnalyzers/AspNetCoreAnalyzers/tree/master/documentation/ASP005.md">ASP005</a></td>
30+
<td><a href="https://github.com/DotNetAnalyzers/AspNetCoreAnalyzers/tree/master/documentation/ASP006.md">ASP006</a></td>
3131
<td>Escape constraint regex.</td>
3232
</tr>
3333
<table>
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# ASP005
1+
# ASP006
22
## Escape constraint regex.
33

44
<!-- start generated table -->
55
<table>
66
<tr>
77
<td>CheckId</td>
8-
<td>ASP005</td>
8+
<td>ASP006</td>
99
</tr>
1010
<tr>
1111
<td>Severity</td>
@@ -62,21 +62,21 @@ Configure the severity per project, for more info see [MSDN](https://msdn.micros
6262

6363
### Via #pragma directive.
6464
```C#
65-
#pragma warning disable ASP005 // Escape constraint regex.
65+
#pragma warning disable ASP006 // Escape constraint regex.
6666
Code violating the rule here
67-
#pragma warning restore ASP005 // Escape constraint regex.
67+
#pragma warning restore ASP006 // Escape constraint regex.
6868
```
6969

7070
Or put this at the top of the file to disable all instances.
7171
```C#
72-
#pragma warning disable ASP005 // Escape constraint regex.
72+
#pragma warning disable ASP006 // Escape constraint regex.
7373
```
7474

7575
### Via attribute `[SuppressMessage]`.
7676

7777
```C#
7878
[System.Diagnostics.CodeAnalysis.SuppressMessage("AspNetCoreAnalyzers.Routing",
79-
"ASP005:Escape constraint regex.",
79+
"ASP006:Escape constraint regex.",
8080
Justification = "Reason...")]
8181
```
8282
<!-- end generated config severity -->

documentation/ASP006.md.generated

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# ASP006
2+
## Escape constraint regex.
3+
4+
<!-- start generated table -->
5+
<table>
6+
<tr>
7+
<td>CheckId</td>
8+
<td>ASP006</td>
9+
</tr>
10+
<tr>
11+
<td>Severity</td>
12+
<td>Warning</td>
13+
</tr>
14+
<tr>
15+
<td>Enabled</td>
16+
<td>True</td>
17+
</tr>
18+
<tr>
19+
<td>Category</td>
20+
<td>AspNetCoreAnalyzers.Routing</td>
21+
</tr>
22+
<tr>
23+
<td>Code</td>
24+
<td><a href="https://github.com/DotNetAnalyzers/AspNetCoreAnalyzers/blob/master/AspNetCoreAnalyzers/Analyzers/AttributeAnalyzer.cs">AttributeAnalyzer</a></td>
25+
</tr>
26+
</table>
27+
<!-- end generated table -->
28+
29+
## Description
30+
31+
Escape constraint regex.
32+
33+
## Motivation
34+
35+
ADD MOTIVATION HERE
36+
37+
## How to fix violations
38+
39+
ADD HOW TO FIX VIOLATIONS HERE
40+
41+
<!-- start generated config severity -->
42+
## Configure severity
43+
44+
### Via ruleset file.
45+
46+
Configure the severity per project, for more info see [MSDN](https://msdn.microsoft.com/en-us/library/dd264949.aspx).
47+
48+
### Via #pragma directive.
49+
```C#
50+
#pragma warning disable ASP006 // Escape constraint regex.
51+
Code violating the rule here
52+
#pragma warning restore ASP006 // Escape constraint regex.
53+
```
54+
55+
Or put this at the top of the file to disable all instances.
56+
```C#
57+
#pragma warning disable ASP006 // Escape constraint regex.
58+
```
59+
60+
### Via attribute `[SuppressMessage]`.
61+
62+
```C#
63+
[System.Diagnostics.CodeAnalysis.SuppressMessage("AspNetCoreAnalyzers.Routing",
64+
"ASP006:Escape constraint regex.",
65+
Justification = "Reason...")]
66+
```
67+
<!-- end generated config severity -->

0 commit comments

Comments
 (0)