Variable or parameter name is not snake_case
ID |
c.maintainability.naming_identifier_style |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Naming |
Language |
C / C++ |
Description
Identifier $N is not named in snake_case. By convention, C/C++ local variables and function parameters use lowercase names with underscores (e.g. input_data) so they read consistently and are easy to distinguish from types and macros. Rename the identifier to match ^[a-z][a-z0-9_]*$.
Rationale
Identifier $N is not named in snake_case. By convention, C/C++ local variables and function parameters use lowercase names with underscores (e.g. input_data) so they read consistently and are easy to distinguish from types and macros. Rename the identifier to match ^[a-z][a-z0-9_]*$.
The following code illustrates the pattern detected by this rule:
// FLAGGED: Variable or parameter name is not snake_case
int process(int inputData, int n) { return inputData + n; }