Skip to content

Commit

Permalink
Correct diagnostic grammar and enable analyzer release tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddotcs committed May 25, 2023
1 parent 0d7a77d commit dd3778e
Show file tree
Hide file tree
Showing 25 changed files with 74 additions and 55 deletions.
15 changes: 15 additions & 0 deletions src/SafeRouting.Generator/AnalyzerReleases.Shipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
; Shipped analyzer releases
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

## Release 1.0.0

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
CSR0001 | SafeRouting.Generator.RouteGenerator | Error | Diagnostics
CSR0002 | SafeRouting.Generator.RouteGenerator | Error | Diagnostics
CSR0003 | SafeRouting.Generator.RouteGenerator | Error | Diagnostics
CSR0004 | SafeRouting.Generator.RouteGenerator | Error | Diagnostics
CSR0005 | SafeRouting.Generator.RouteGenerator | Error | Diagnostics
CSR0006 | SafeRouting.Generator.RouteGenerator | Error | Diagnostics
2 changes: 2 additions & 0 deletions src/SafeRouting.Generator/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; Unshipped analyzer release
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
12 changes: 7 additions & 5 deletions src/SafeRouting.Generator/Diagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,49 @@ public static Diagnostic CreateUnsupportedLanguageVersionDiagnostic()
private static readonly DiagnosticDescriptor ConflictingMethodsDescriptor = new(
id: "CSR0001",
title: "Conflicting methods",
messageFormat: "The class '{0}' contains multiple methods which map to the route method '{1}'.",
messageFormat: "The class '{0}' contains multiple methods which map to the route method '{1}'",
category: typeof(RouteGenerator).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true);

private static readonly DiagnosticDescriptor InvalidOptionsDescriptor = new(
id: "CSR0002",
title: "Invalid options",
#pragma warning disable RS1032 // Define diagnostic message correctly - errorText is expected to end in a period
messageFormat: "Value for the option '{0}' is invalid. {1}",
#pragma warning restore RS1032
category: typeof(RouteGenerator).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true);

private static readonly DiagnosticDescriptor InvalidIdentifierDescriptor = new(
id: "CSR0003",
title: "Invalid identifier",
messageFormat: "The text '{0}' is not a valid C# identifier.",
messageFormat: "The text '{0}' is not a valid C# identifier",
category: typeof(RouteGenerator).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true);

private static readonly DiagnosticDescriptor ConflictingControllerDescriptor = new(
id: "CSR0004",
title: "Conflicting Controller",
messageFormat: "The controller '{0}' conflicts with another controller of the same name.",
messageFormat: "The controller '{0}' conflicts with another controller of the same name",
category: typeof(RouteGenerator).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true);

private static readonly DiagnosticDescriptor ConflictingPageClassDescriptor = new(
id: "CSR0005",
title: "Conflicting PageModel Class",
messageFormat: "The page class '{0}' conflicts with another page class with the same resulting name.",
messageFormat: "The page class '{0}' conflicts with another page class with the same resulting name",
category: typeof(RouteGenerator).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true);

private static readonly DiagnosticDescriptor UnsupportedLanguageVersionDescriptor = new(
id: "CSR0006",
title: "Unsupported Language Version",
messageFormat: "C# 8 or later is required for route generation.",
messageFormat: "C# 8 or later is required for route generation",
category: typeof(RouteGenerator).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (0,0)-(0,0),
Description: ,
HelpLink: ,
MessageFormat: C# 8 or later is required for route generation.,
Message: C# 8 or later is required for route generation.,
MessageFormat: C# 8 or later is required for route generation,
Message: C# 8 or later is required for route generation,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (5,3)-(5,32),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '%&*$#(.' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '%&*$#(.' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (7,2)-(8,68),
Description: ,
HelpLink: ,
MessageFormat: The class '{0}' contains multiple methods which map to the route method '{1}'.,
Message: The class 'ProductsController' contains multiple methods which map to the route method 'Index()'.,
MessageFormat: The class '{0}' contains multiple methods which map to the route method '{1}',
Message: The class 'ProductsController' contains multiple methods which map to the route method 'Index()',
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (6,5)-(6,34),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '%&*$#(.' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '%&*$#(.' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
},
{
Expand All @@ -20,8 +20,8 @@
Location: : (7,5)-(7,27),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
},
{
Expand All @@ -32,8 +32,8 @@
Location: : (8,5)-(8,28),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '3' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '3' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
},
{
Expand All @@ -44,8 +44,8 @@
Location: : (9,5)-(9,28),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '@' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '@' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (5,3)-(5,32),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '%&*$#(.' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '%&*$#(.' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (12,2)-(15,3),
Description: ,
HelpLink: ,
MessageFormat: The controller '{0}' conflicts with another controller of the same name.,
Message: The controller 'Products' conflicts with another controller of the same name.,
MessageFormat: The controller '{0}' conflicts with another controller of the same name,
Message: The controller 'Products' conflicts with another controller of the same name,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: : (3,1)-(3,30),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '%&*$#(.' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '%&*$#(.' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: C:\Project\Pages\Products\Edit.cshtml.cs: (5,3)-(5,32),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '%&*$#(.' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '%&*$#(.' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: C:\Project\Pages\Products\Edit.cshtml.cs: (2,0)-(6,1),
Description: ,
HelpLink: ,
MessageFormat: The class '{0}' contains multiple methods which map to the route method '{1}'.,
Message: The class 'EditModel' contains multiple methods which map to the route method 'Get'.,
MessageFormat: The class '{0}' contains multiple methods which map to the route method '{1}',
Message: The class 'EditModel' contains multiple methods which map to the route method 'Get',
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: C:\Project\Pages\Products\Edit.cshtml.cs: (5,21)-(5,50),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '%&*$#(.' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '%&*$#(.' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: C:\Project\Pages\Products\Edit.cshtml.cs: (6,3)-(6,32),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '%&*$#(.' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '%&*$#(.' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: C:\Project\Pages\Products\Edit.cshtml.cs: (14,2)-(19,3),
Description: ,
HelpLink: ,
MessageFormat: The page class '{0}' conflicts with another page class with the same resulting name.,
Message: The page class 'global::B.EditModel' conflicts with another page class with the same resulting name.,
MessageFormat: The page class '{0}' conflicts with another page class with the same resulting name,
Message: The page class 'global::B.EditModel' conflicts with another page class with the same resulting name,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Location: C:\Project\Pages\Products\Edit.cshtml.cs: (3,1)-(3,30),
Description: ,
HelpLink: ,
MessageFormat: The text '{0}' is not a valid C# identifier.,
Message: The text '%&*$#(.' is not a valid C# identifier.,
MessageFormat: The text '{0}' is not a valid C# identifier,
Message: The text '%&*$#(.' is not a valid C# identifier,
Category: SafeRouting.Generator.RouteGenerator
}
]
Expand Down

0 comments on commit dd3778e

Please sign in to comment.