dotnet / dotnet/roslyn

IDE1006 Naming rule for local variables does not work

Open
#80,696 2 comments 0 reactions 1 assignee Claimed by @JoeRobich View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**: .NET SDK 10.0.100-rc.1.25451.107

**Steps to Reproduce**:

1. Set following rule in .editorconfig file:
```ini
dotnet_naming_rule.locals_should_be_camel_case = error
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case

dotnet_naming_symbols.locals.applicable_kinds = local
dotnet_naming_symbols.locals.applicable_accessibilities = local

dotnet_naming_style.camel_case.capitalization = camel_case

dotnet_diagnostic.IDE1006.severity = error
```
2. try to declare such local variable in a method:
```csharp
var ThisIsTheTest = 1;
```
3. Observe the analyzer does not report issue with name being PascalCase instead of camelCase.

**Diagnostic Id**:

IDE1006

**Expected Behavior**:
The naming rules should be applied to local variables.

**Actual Behavior**:
Local variables are not detected, despite being configured correctly in .editorconfig.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.