You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation of the rule has a hard-coded list of interfaces it knows.
If a developer implements an extra interface also following CRTP it currently would need to write its own analyzer.
It would be nice if the existing rule would either automatically recognize CRTP interfaces or allow configuring additional recognizable interfaces.
Describe suggestions on how to achieve the rule
I see three options:
Recognize CRTP interfaces where a generic parameter is constraint by itself.
Most flexible but could be expensive as the same interface will be analyzed multiple times unless we have a caching capability in the compilation context.
Recognize generic parameter name TSelf
Could be used as a faster initial detection of CRTP, skipping any generic interfaces where the first parameter has a different name before checking the constraints.
Allow specifying additional_interfaces in configuration file.
Analyzer
Diagnostic ID: CA2260
Describe the improvement
The implementation of the rule has a hard-coded list of interfaces it knows.
If a developer implements an extra interface also following CRTP it currently would need to write its own analyzer.
It would be nice if the existing rule would either automatically recognize CRTP interfaces or allow configuring additional recognizable interfaces.
Describe suggestions on how to achieve the rule
I see three options:
TSelf
additional_interfaces
in configuration file.Additional context
The auto detection would help if the dotnet runtime adds more CRTP interface definition without the need to update the analyzer rule.
If any of the suggestions are acceptable, I'm happy to contribute and update the analyzer.
The text was updated successfully, but these errors were encountered: