-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write a meta-analyzer to flag analyzers that use VB/C# compiler reserved diagnostic IDs #1727
Comments
This PR reverts that change and a similar diagnostic will be implemented as an analyzer with dotnet/roslyn-analyzers#1727. Fixes dotnet#25748
@mavasani so the idea here is to report on diagnostic ids with the following patterns: |
We only want to flag CS and BC prefixes followed by and integral suffix as they would clash with C# and VB compiler diagnostic IDs respectively. No other prefixes should be flagged. |
We would also flag the special diagnostic ID |
@Evangelink based on the discussions at dotnet/roslyn#40351, I think your original suggestion of flagging even CA IDs seems reasonable. I think we should make this rule configurable so end users can tweak the banned regex to their own preference. For example, a repo might want to outright enforce that only a certain prefix and length of ID be used. We have a very similar rule which allows users to provide a custom additional file to enforce the category and rule ID mapping, rule ID prefix and format: Lines 419 to 664 in 9c08642
|
@mavasani So to sum it up, I need to create a new analyzer which by default will handle:
Nothing hardcoded for It will also allow users to provide a regex as ID check for each category. Does it need to be in the |
@Evangelink I think we should start with a simple analyzer that just flags CA, BC and CS diagnostics. I don't think you need to check specific digit count after the prefix, but just that it is a number. Let's leave adding configurability as a separate follow-up item, if we get customer requests. For flagging the CA diagnostics, you probably need to add a hardcoded list of assembly names that shouldn't be flagged, which should include |
See dotnet/roslyn#25748 for more details and previous attempt to put such an diagnostic in the compiler itself
The text was updated successfully, but these errors were encountered: