IntelliTect / IntelliTect/CodingGuidelines

Add analyzer that flags var in pattern matching

Aperta
#52 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
C#
Stelle
12
Fork
16
Merge medio
2m
PR unite (30g)
7

Descrizione

Based on internal discussion.
Pattern matching with var provides little value since it effectively matches everything and ends up copying to a local value.

Match on this
```
if ( bar is var foo )
```

Suggested code change (just to help educate people)
```
var foo = bar;
if ( true )
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

No files, tests, or analyzer entry points are named in the issue. First locate the repository's analyzer implementation and test layout, then use the var-in-pattern example as the reproduction; done means the analyzer flags this pattern and the behavior is covered by tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.