Class or struct name is not PascalCase

ID

c.maintainability.naming_class

Severity

info

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Naming

Language

C / C++

Description

Type $C is not named in PascalCase. By convention, C++ classes and structs use UpperCamelCase names (e.g. MyClass) so type names stand out from variables and functions. Rename the type to match ^[A-Z][A-Za-z0-9]*$.

Rationale

Type $C is not named in PascalCase. By convention, C++ classes and structs use UpperCamelCase names (e.g. MyClass) so type names stand out from variables and functions. Rename the type to match ^[A-Z][A-Za-z0-9]*$.

The following code illustrates the pattern detected by this rule:

// FLAGGED: Class or struct name is not PascalCase
class my_class { int x; };

Remediation

Follow secure coding practices and review the references below for detailed remediation guidance.

Configuration

This detector does not need any configuration.