Naming Method
ID |
csharp.naming_method |
Severity |
low |
Remediation Complexity |
trivial |
Remediation Risk |
medium |
Remediation Effort |
low |
Resource |
Naming Convention |
Language |
CSharp |
Tags |
naming |
Description
Reports C# method names that do not follow the PascalCase convention. A method
name must start with an uppercase letter and contain no underscores.
Rationale
The .NET design guidelines specify PascalCase for method names. Consistent
casing is one of the strongest readability signals in a codebase, and tooling,
frameworks and other developers all rely on that expectation. A method called
do_work or computeTotal stands out as foreign and slows down everyone reading
the code.
public class Service
{
public void Compute() { } // OK
public void compute() { } // FLAW — starts lowercase
public void do_work() { } // FLAW — lowercase and underscore
public void Do_Work() { } // FLAW — contains underscore
}