pi-lens
Version:
Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo
51 lines (40 loc) • 1.22 kB
YAML
# Async/Await as Identifiers
# Detects async and await used as identifiers in C#
id: async-await-identifiers
name: async and await Should Not Be Used as Identifiers
severity: warning
category: maintainability
defect_class: correctness
inline_tier: warning
language: csharp
message: "'async' and 'await' should not be used as identifiers"
description: |
Using async and await as identifiers is confusing and may cause
conflicts with the async/await keywords. Use different names.
✅ FIX: Use descriptive names that don't conflict with keywords
```csharp
bool isAsyncOperation = true; // GOOD - descriptive
```
query: |
(variable_declarator
(identifier) (#match? "^(async|await)$"))
(parameter
(identifier) (#match? "^(async|await)$"))
(property_declaration
name: (identifier) (#match? "^(async|await)$"))
metavars:
- NAME
tags:
- maintainability
- csharp
- pitfall
- readability
examples:
bad: |
int async = 5; // BAD - keyword as identifier
void Method(int await) { } // BAD
good: |
int asyncOperation = 5; // GOOD - descriptive
void Method(int waitTime) { } // GOOD
has_fix: true
fix_action: rename_identifier