dotnet/roslyn

"Add Constraints" Code-Fix

Ouverte

#50 479 ouverte le 14 janv. 2021

 (1 commentaire) (0 réaction) (0 personne assignée)C# (4 257 forks)batch import
Area-IDEIDE-CodeStylehelp wanted

Métriques du dépôt

Stars
 (20 414 étoiles)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

Description

Brief description: When working with a generic class, it would be nice if I could run a code-fix to automatically add missing constraints from a base class.

Languages applicable: All languages

Code example that the analyzer should report:

public class Derived<TKey, TJson, TStorage> : base<TKey, TJson, TStorage> {

}

 public abstract class Base<TKey, TJson, TStorage>
        where TKey : notnull
        where TJson : JsonBase<TKey>, new()
        where TStorage : StorageBase<TKey, TJson>, new()
        {

}

Additional information: None.

Documentation requirements:

When this analyzer is implemented, it must be documented by following the steps at Documentation for IDE CodeStyle analyzers.

Guide contributeur