IntelliTect / IntelliTect/CodingGuidelines

Add analyzer that flags var in pattern matching

Open
#52 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
12
Forks
16
Avg merge
2m
Merged PRs (30d)
7

Description

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 )
```

Contributor guide

Open the contributing guide

Research direction

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.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.