readability-identifier-naming¶
Checks for identifiers naming style mismatch.
This check will try to enforce coding guidelines on the identifiers naming. It supports one of the following casing types and tries to convert from one to another if a mismatch is detected
Casing types include:
lower_caseUPPER_CASEcamelBackCamelCasecamel_Snake_BackCamel_Snake_CaseaNy_CasELeading_upper_snake_case
It also supports a fixed prefix and suffix that will be prepended or appended to the identifiers, regardless of the casing.
Many configuration options are available, in order to be able to create different rules for different kinds of identifiers. In general, the rules are falling back to a more generic rule if the specific case is not configured.
The naming of virtual methods is reported where they occur in the base class, but not where they are overridden, as it can’t be fixed locally there. This also applies for pseudo-override patterns like CRTP.
Leading_upper_snake_case is a naming convention where the first word is
capitalized followed by lower case word(s) separated by underscore(s) ‘_’.
Examples include: Cap_snake_case, Cobra_case, Foo_bar_baz,
and Master_copy_8gb.
Hungarian notation can be customized using different HungarianPrefix settings. The options and their corresponding values are:
Off- the default settingOn- example:int iVariableLowerCase- example:int i_VariableCamelCase- example:int IVariable
The check only enforces style on kinds of identifiers which have been
configured, so an empty config effectively disables it.
The DefaultCase option can be used to enforce style on all kinds of
identifiers, then optionally overriden for specific kinds which are desired
with a different case.
For example using values of:
DefaultCaseoflower_caseMacroDefinitionCaseofUPPER_CASETemplateParameterCaseofCamelCase
Identifies and transforms names as follows:
Before:
#define macroDefinition
template <typename typenameParameter>
int functionDeclaration(typenameParameter paramVal, int paramCount);
After:
#define MACRO_DEFINITION
template <typename TypenameParameter>
int function_declarations(TypenameParameter param_val, int param_count);
Options summary¶
The available options are summarized below:
General options
Specific options
DefaultCase,DefaultPrefix,DefaultSuffix,DefaultIgnoredRegexp,DefaultHungarianPrefixAbstractClassCase,AbstractClassPrefix,AbstractClassSuffix,AbstractClassIgnoredRegexp,AbstractClassHungarianPrefixClassCase,ClassPrefix,ClassSuffix,ClassIgnoredRegexp,ClassHungarianPrefixClassConstexprCase,ClassConstexprPrefix,ClassConstexprSuffix,ClassConstexprIgnoredRegexp,ClassConstexprHungarianPrefixClassConstantCase,ClassConstantPrefix,ClassConstantSuffix,ClassConstantIgnoredRegexp,ClassConstantHungarianPrefixClassMemberCase,ClassMemberPrefix,ClassMemberSuffix,ClassMemberIgnoredRegexp,ClassMemberHungarianPrefixClassMethodCase,ClassMethodPrefix,ClassMethodSuffix,ClassMethodIgnoredRegexpConceptCase,ConceptPrefix,ConceptSuffix,ConceptIgnoredRegexpConstantCase,ConstantPrefix,ConstantSuffix,ConstantIgnoredRegexp,ConstantHungarianPrefixConstantMemberCase,ConstantMemberPrefix,ConstantMemberSuffix,ConstantMemberIgnoredRegexp,ConstantMemberHungarianPrefixConstantParameterCase,ConstantParameterPrefix,ConstantParameterSuffix,ConstantParameterIgnoredRegexp,ConstantParameterHungarianPrefixConstantPointerParameterCase,ConstantPointerParameterPrefix,ConstantPointerParameterSuffix,ConstantPointerParameterIgnoredRegexp,ConstantPointerParameterHungarianPrefixConstexprFunctionCase,ConstexprFunctionPrefix,ConstexprFunctionSuffix,ConstexprFunctionIgnoredRegexpConstexprMethodCase,ConstexprMethodPrefix,ConstexprMethodSuffix,ConstexprMethodIgnoredRegexpConstexprVariableCase,ConstexprVariablePrefix,ConstexprVariableSuffix,ConstexprVariableIgnoredRegexp,ConstexprVariableHungarianPrefixEnumConstantCase,EnumConstantPrefix,EnumConstantSuffix,EnumConstantIgnoredRegexp,EnumConstantHungarianPrefixFunctionCase,FunctionPrefix,FunctionSuffix,FunctionIgnoredRegexpGlobalConstexprVariableCase,GlobalConstexprVariablePrefix,GlobalConstexprVariableSuffix,GlobalConstexprVariableIgnoredRegexp,GlobalConstexprVariableHungarianPrefixGlobalConstantCase,GlobalConstantPrefix,GlobalConstantSuffix,GlobalConstantIgnoredRegexp,GlobalConstantHungarianPrefixGlobalConstantPointerCase,GlobalConstantPointerPrefix,GlobalConstantPointerSuffix,GlobalConstantPointerIgnoredRegexp,GlobalConstantPointerHungarianPrefixGlobalFunctionCase,GlobalFunctionPrefix,GlobalFunctionSuffix,GlobalFunctionIgnoredRegexpGlobalPointerCase,GlobalPointerPrefix,GlobalPointerSuffix,GlobalPointerIgnoredRegexp,GlobalPointerHungarianPrefixGlobalVariableCase,GlobalVariablePrefix,GlobalVariableSuffix,GlobalVariableIgnoredRegexp,GlobalVariableHungarianPrefixInlineNamespaceCase,InlineNamespacePrefix,InlineNamespaceSuffix,InlineNamespaceIgnoredRegexpLambdaCaptureCase,LambdaCapturePrefix,LambdaCaptureSuffix,LambdaCaptureIgnoredRegexp,LambdaCaptureHungarianPrefixLocalConstexprVariableCase,LocalConstexprVariablePrefix,LocalConstexprVariableSuffix,LocalConstexprVariableIgnoredRegexp,LocalConstexprVariableHungarianPrefixLocalConstantCase,LocalConstantPrefix,LocalConstantSuffix,LocalConstantIgnoredRegexp,LocalConstantHungarianPrefixLocalConstantPointerCase,LocalConstantPointerPrefix,LocalConstantPointerSuffix,LocalConstantPointerIgnoredRegexp,LocalConstantPointerHungarianPrefixLocalPointerCase,LocalPointerPrefix,LocalPointerSuffix,LocalPointerIgnoredRegexp,LocalPointerHungarianPrefixLocalVariableCase,LocalVariablePrefix,LocalVariableSuffix,LocalVariableIgnoredRegexp,LocalVariableHungarianPrefixMacroDefinitionCase,MacroDefinitionPrefix,MacroDefinitionSuffix,MacroDefinitionIgnoredRegexpMemberCase,MemberPrefix,MemberSuffix,MemberIgnoredRegexp,MemberHungarianPrefixNamespaceCase,NamespacePrefix,NamespaceSuffix,NamespaceIgnoredRegexpParameterCase,ParameterPrefix,ParameterSuffix,ParameterIgnoredRegexp,ParameterHungarianPrefixParameterPackCase,ParameterPackPrefix,ParameterPackSuffix,ParameterPackIgnoredRegexpPointerParameterCase,PointerParameterPrefix,PointerParameterSuffix,PointerParameterIgnoredRegexp,PointerParameterHungarianPrefixPrivateMemberCase,PrivateMemberPrefix,PrivateMemberSuffix,PrivateMemberIgnoredRegexp,PrivateMemberHungarianPrefixPrivateMethodCase,PrivateMethodPrefix,PrivateMethodSuffix,PrivateMethodIgnoredRegexpProtectedMemberCase,ProtectedMemberPrefix,ProtectedMemberSuffix,ProtectedMemberIgnoredRegexp,ProtectedMemberHungarianPrefixProtectedMethodCase,ProtectedMethodPrefix,ProtectedMethodSuffix,ProtectedMethodIgnoredRegexpPublicMemberCase,PublicMemberPrefix,PublicMemberSuffix,PublicMemberIgnoredRegexp,PublicMemberHungarianPrefixPublicMethodCase,PublicMethodPrefix,PublicMethodSuffix,PublicMethodIgnoredRegexpScopedEnumConstantCase,ScopedEnumConstantPrefix,ScopedEnumConstantSuffix,ScopedEnumConstantIgnoredRegexpStaticConstexprVariableCase,StaticConstexprVariablePrefix,StaticConstexprVariableSuffix,StaticConstexprVariableIgnoredRegexp,StaticConstexprVariableHungarianPrefixStaticConstantCase,StaticConstantPrefix,StaticConstantSuffix,StaticConstantIgnoredRegexp,StaticConstantHungarianPrefixStaticVariableCase,StaticVariablePrefix,StaticVariableSuffix,StaticVariableIgnoredRegexp,StaticVariableHungarianPrefixTemplateParameterCase,TemplateParameterPrefix,TemplateParameterSuffix,TemplateParameterIgnoredRegexpTemplateTemplateParameterCase,TemplateTemplateParameterPrefix,TemplateTemplateParameterSuffix,TemplateTemplateParameterIgnoredRegexpTypeAliasCase,TypeAliasPrefix,TypeAliasSuffix,TypeAliasIgnoredRegexpTypedefCase,TypedefPrefix,TypedefSuffix,TypedefIgnoredRegexpTypeTemplateParameterCase,TypeTemplateParameterPrefix,TypeTemplateParameterSuffix,TypeTemplateParameterIgnoredRegexpValueTemplateParameterCase,ValueTemplateParameterPrefix,ValueTemplateParameterSuffix,ValueTemplateParameterIgnoredRegexpVariableCase,VariablePrefix,VariableSuffix,VariableIgnoredRegexp,VariableHungarianPrefixVirtualMethodCase,VirtualMethodPrefix,VirtualMethodSuffix,VirtualMethodIgnoredRegexp
Options description¶
A detailed description of each option is presented below:
- DefaultCase¶
When defined, the check will ensure all names by default conform to the selected casing.
- DefaultPrefix¶
When defined, the check will ensure all names by default will add the prefix with the given value (regardless of casing).
- DefaultIgnoredRegexp¶
Identifier naming checks won’t be enforced for all names by default matching this regular expression.
- DefaultSuffix¶
When defined, the check will ensure all names by default will add the suffix with the given value (regardless of casing).
- DefaultHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
- AbstractClassCase¶
When defined, the check will ensure abstract class names conform to the selected casing.
- AbstractClassPrefix¶
When defined, the check will ensure abstract class names will add the prefix with the given value (regardless of casing).
- AbstractClassIgnoredRegexp¶
Identifier naming checks won’t be enforced for abstract class names matching this regular expression.
- AbstractClassSuffix¶
When defined, the check will ensure abstract class names will add the suffix with the given value (regardless of casing).
- AbstractClassHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
AbstractClassCaseoflower_caseAbstractClassPrefixofpre_AbstractClassSuffixof_post
Identifies and/or transforms abstract class names as follows:
Before:
class ABSTRACT_CLASS {
public:
ABSTRACT_CLASS();
};
After:
class pre_abstract_class_post {
public:
pre_abstract_class_post();
};
- AggressiveDependentMemberLookup¶
When
true, the check will look in dependent base classes for dependent member references that need changing. This can lead to errors with template specializations. Default isfalse.
For example using values of:
ClassMemberCaseoflower_case
Before:
template <typename T>
struct Base {
T BadNamedMember;
};
template <typename T>
struct Derived : Base<T> {
void reset() {
this->BadNamedMember = 0;
}
};
After if AggressiveDependentMemberLookup is false:
template <typename T>
struct Base {
T bad_named_member;
};
template <typename T>
struct Derived : Base<T> {
void reset() {
this->BadNamedMember = 0;
}
};
After if AggressiveDependentMemberLookup is true:
template <typename T>
struct Base {
T bad_named_member;
};
template <typename T>
struct Derived : Base<T> {
void reset() {
this->bad_named_member = 0;
}
};
- CheckAnonFieldInParent¶
When
true, fields in anonymous records (i.e. anonymous unions and structs) will be treated as names in the enclosing scope rather than public members of the anonymous record for the purpose of name checking.
For example:
class Foo {
private:
union {
int iv_;
float fv_;
};
};
If CheckAnonFieldInParent is false, you may get warnings
that iv_ and fv_ are not coherent to public member names, because
iv_ and fv_ are public members of the anonymous union. When
CheckAnonFieldInParent is true, iv_ and fv_ will be
treated as private data members of Foo for the purpose of name checking
and thus no warnings will be emitted.
- ClassCase¶
When defined, the check will ensure class names conform to the selected casing.
- ClassPrefix¶
When defined, the check will ensure class names will add the prefix with the given value (regardless of casing).
- ClassIgnoredRegexp¶
Identifier naming checks won’t be enforced for class names matching this regular expression.
- ClassSuffix¶
When defined, the check will ensure class names will add the suffix with the given value (regardless of casing).
- ClassHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ClassCaseoflower_caseClassPrefixofpre_ClassSuffixof_postClassHungarianPrefixofOn
Identifies and/or transforms class names as follows:
Before:
class FOO {
public:
FOO();
~FOO();
};
After:
class pre_foo_post {
public:
pre_foo_post();
~pre_foo_post();
};
- ClassConstexprCase¶
When defined, the check will ensure class
constexprnames conform to the selected casing.
- ClassConstexprPrefix¶
When defined, the check will ensure class
constexprnames will add the prefix with the given value (regardless of casing).
- ClassConstexprIgnoredRegexp¶
Identifier naming checks won’t be enforced for class
constexprnames matching this regular expression.
- ClassConstexprSuffix¶
When defined, the check will ensure class
constexprnames will add the suffix with the given value (regardless of casing).
- ClassConstexprHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ClassConstexprCaseoflower_caseClassConstexprPrefixofpre_ClassConstexprSuffixof_post
Identifies and/or transforms class constexpr variable names as follows:
Before:
class FOO {
public:
static constexpr int CLASS_CONSTEXPR;
};
After:
class FOO {
public:
static const int pre_class_constexpr_post;
};
- ClassConstantCase¶
When defined, the check will ensure class constant names conform to the selected casing.
- ClassConstantPrefix¶
When defined, the check will ensure class constant names will add the prefix with the given value (regardless of casing).
- ClassConstantIgnoredRegexp¶
Identifier naming checks won’t be enforced for class constant names matching this regular expression.
- ClassConstantSuffix¶
When defined, the check will ensure class constant names will add the suffix with the given value (regardless of casing).
- ClassConstantHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ClassConstantCaseoflower_caseClassConstantPrefixofpre_ClassConstantSuffixof_post
Identifies and/or transforms class constant names as follows:
Before:
class FOO {
public:
static const int CLASS_CONSTANT;
};
After:
class FOO {
public:
static const int pre_class_constant_post;
};
- ClassMemberCase¶
When defined, the check will ensure class member names conform to the selected casing.
- ClassMemberPrefix¶
When defined, the check will ensure class member names will add the prefix with the given value (regardless of casing).
- ClassMemberIgnoredRegexp¶
Identifier naming checks won’t be enforced for class member names matching this regular expression.
- ClassMemberSuffix¶
When defined, the check will ensure class member names will add the suffix with the given value (regardless of casing).
- ClassMemberHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ClassMemberCaseoflower_caseClassMemberPrefixofpre_ClassMemberSuffixof_post
Identifies and/or transforms class member names as follows:
Before:
class FOO {
public:
static int CLASS_CONSTANT;
};
After:
class FOO {
public:
static int pre_class_constant_post;
};
- ClassMethodCase¶
When defined, the check will ensure class method names conform to the selected casing.
- ClassMethodPrefix¶
When defined, the check will ensure class method names will add the prefix with the given value (regardless of casing).
- ClassMethodIgnoredRegexp¶
Identifier naming checks won’t be enforced for class method names matching this regular expression.
- ClassMethodSuffix¶
When defined, the check will ensure class method names will add the suffix with the given value (regardless of casing).
For example using values of:
ClassMethodCaseoflower_caseClassMethodPrefixofpre_ClassMethodSuffixof_post
Identifies and/or transforms class method names as follows:
Before:
class FOO {
public:
int CLASS_MEMBER();
};
After:
class FOO {
public:
int pre_class_member_post();
};
- ConceptCase¶
When defined, the check will ensure concept names conform to the selected casing.
- ConceptPrefix¶
When defined, the check will ensure concept names will add the prefix with the given value (regardless of casing).
- ConceptIgnoredRegexp¶
Identifier naming checks won’t be enforced for concept names matching this regular expression.
- ConceptSuffix¶
When defined, the check will ensure concept names will add the suffix with the given value (regardless of casing).
For example using values of:
ConceptCaseofCamelCaseConceptPrefixofPreConceptSuffixofPost
Identifies and/or transforms concept names as follows:
Before:
template<typename T> concept my_concept = requires (T t) { {t++}; };
After:
template<typename T> concept PreMyConceptPost = requires (T t) { {t++}; };
- ConstantCase¶
When defined, the check will ensure constant names conform to the selected casing.
- ConstantPrefix¶
When defined, the check will ensure constant names will add the prefix with the given value (regardless of casing).
- ConstantIgnoredRegexp¶
Identifier naming checks won’t be enforced for constant names matching this regular expression.
- ConstantSuffix¶
When defined, the check will ensure constant names will add the suffix with the given value (regardless of casing).
- ConstantHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ConstantCaseoflower_caseConstantPrefixofpre_ConstantSuffixof_postConstantHungarianPrefixofOn
Identifies and/or transforms constant names as follows:
Before:
void function() { unsigned const MyConst_array[] = {1, 2, 3}; }
After:
void function() { unsigned const pre_myconst_array_post[] = {1, 2, 3}; }
- ConstantMemberCase¶
When defined, the check will ensure constant member names conform to the selected casing.
- ConstantMemberPrefix¶
When defined, the check will ensure constant member names will add the prefix with the given value (regardless of casing).
- ConstantMemberIgnoredRegexp¶
Identifier naming checks won’t be enforced for constant member names matching this regular expression.
- ConstantMemberSuffix¶
When defined, the check will ensure constant member names will add the suffix with the given value (regardless of casing).
- ConstantMemberHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ConstantMemberCaseoflower_caseConstantMemberPrefixofpre_ConstantMemberSuffixof_post
Identifies and/or transforms constant member names as follows:
Before:
class Foo {
char const MY_ConstMember_string[4] = "123";
}
After:
class Foo {
char const pre_my_constmember_string_post[4] = "123";
}
- ConstantParameterCase¶
When defined, the check will ensure constant parameter names conform to the selected casing.
- ConstantParameterPrefix¶
When defined, the check will ensure constant parameter names will add the prefix with the given value (regardless of casing).
- ConstantParameterIgnoredRegexp¶
Identifier naming checks won’t be enforced for constant parameter names matching this regular expression.
- ConstantParameterSuffix¶
When defined, the check will ensure constant parameter names will add the suffix with the given value (regardless of casing).
- ConstantParameterHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ConstantParameterCaseoflower_caseConstantParameterPrefixofpre_ConstantParameterSuffixof_post
Identifies and/or transforms constant parameter names as follows:
Before:
void GLOBAL_FUNCTION(int PARAMETER_1, int const CONST_parameter);
After:
void GLOBAL_FUNCTION(int PARAMETER_1, int const pre_const_parameter_post);
- ConstantPointerParameterCase¶
When defined, the check will ensure constant pointer parameter names conform to the selected casing.
- ConstantPointerParameterPrefix¶
When defined, the check will ensure constant pointer parameter names will add the prefix with the given value (regardless of casing).
- ConstantPointerParameterIgnoredRegexp¶
Identifier naming checks won’t be enforced for constant pointer parameter names matching this regular expression.
- ConstantPointerParameterSuffix¶
When defined, the check will ensure constant pointer parameter names will add the suffix with the given value (regardless of casing).
- ConstantPointerParameterHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ConstantPointerParameterCaseoflower_caseConstantPointerParameterPrefixofpre_ConstantPointerParameterSuffixof_post
Identifies and/or transforms constant pointer parameter names as follows:
Before:
void GLOBAL_FUNCTION(int const *CONST_parameter);
After:
void GLOBAL_FUNCTION(int const *pre_const_parameter_post);
- ConstexprFunctionCase¶
When defined, the check will ensure constexpr function names conform to the selected casing.
- ConstexprFunctionPrefix¶
When defined, the check will ensure constexpr function names will add the prefix with the given value (regardless of casing).
- ConstexprFunctionIgnoredRegexp¶
Identifier naming checks won’t be enforced for constexpr function names matching this regular expression.
- ConstexprFunctionSuffix¶
When defined, the check will ensure constexpr function names will add the suffix with the given value (regardless of casing).
For example using values of:
ConstexprFunctionCaseoflower_caseConstexprFunctionPrefixofpre_ConstexprFunctionSuffixof_post
Identifies and/or transforms constexpr function names as follows:
Before:
constexpr int CE_function() { return 3; }
After:
constexpr int pre_ce_function_post() { return 3; }
- ConstexprMethodCase¶
When defined, the check will ensure constexpr method names conform to the selected casing.
- ConstexprMethodPrefix¶
When defined, the check will ensure constexpr method names will add the prefix with the given value (regardless of casing).
- ConstexprMethodIgnoredRegexp¶
Identifier naming checks won’t be enforced for constexpr method names matching this regular expression.
- ConstexprMethodSuffix¶
When defined, the check will ensure constexpr method names will add the suffix with the given value (regardless of casing).
For example using values of:
ConstexprMethodCaseoflower_caseConstexprMethodPrefixofpre_ConstexprMethodSuffixof_post
Identifies and/or transforms constexpr method names as follows:
Before:
class Foo {
public:
constexpr int CST_expr_Method() { return 2; }
}
After:
class Foo {
public:
constexpr int pre_cst_expr_method_post() { return 2; }
}
- ConstexprVariableCase¶
When defined, the check will ensure constexpr variable names conform to the selected casing.
- ConstexprVariablePrefix¶
When defined, the check will ensure constexpr variable names will add the prefix with the given value (regardless of casing).
- ConstexprVariableIgnoredRegexp¶
Identifier naming checks won’t be enforced for constexpr variable names matching this regular expression.
- ConstexprVariableSuffix¶
When defined, the check will ensure constexpr variable names will add the suffix with the given value (regardless of casing).
- ConstexprVariableHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ConstexprVariableCaseoflower_caseConstexprVariablePrefixofpre_ConstexprVariableSuffixof_post
Identifies and/or transforms constexpr variable names as follows:
Before:
constexpr int ConstExpr_variable = MyConstant;
After:
constexpr int pre_constexpr_variable_post = MyConstant;
- EnumCase¶
When defined, the check will ensure enumeration names conform to the selected casing.
- EnumPrefix¶
When defined, the check will ensure enumeration names will add the prefix with the given value (regardless of casing).
- EnumIgnoredRegexp¶
Identifier naming checks won’t be enforced for enumeration names matching this regular expression.
- EnumSuffix¶
When defined, the check will ensure enumeration names will add the suffix with the given value (regardless of casing).
For example using values of:
EnumCaseoflower_caseEnumPrefixofpre_EnumSuffixof_post
Identifies and/or transforms enumeration names as follows:
Before:
enum FOO { One, Two, Three };
After:
enum pre_foo_post { One, Two, Three };
- EnumConstantCase¶
When defined, the check will ensure enumeration constant names conform to the selected casing.
- EnumConstantPrefix¶
When defined, the check will ensure enumeration constant names will add the prefix with the given value (regardless of casing).
- EnumConstantIgnoredRegexp¶
Identifier naming checks won’t be enforced for enumeration constant names matching this regular expression.
- EnumConstantSuffix¶
When defined, the check will ensure enumeration constant names will add the suffix with the given value (regardless of casing).
- EnumConstantHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
EnumConstantCaseoflower_caseEnumConstantPrefixofpre_EnumConstantSuffixof_post
Identifies and/or transforms enumeration constant names as follows:
Before:
enum FOO { One, Two, Three };
After:
enum FOO { pre_One_post, pre_Two_post, pre_Three_post };
- FunctionCase¶
When defined, the check will ensure function names conform to the selected casing.
- FunctionPrefix¶
When defined, the check will ensure function names will add the prefix with the given value (regardless of casing).
- FunctionIgnoredRegexp¶
Identifier naming checks won’t be enforced for function names matching this regular expression.
- FunctionSuffix¶
When defined, the check will ensure function names will add the suffix with the given value (regardless of casing).
For example using values of:
FunctionCaseoflower_caseFunctionPrefixofpre_FunctionSuffixof_post
Identifies and/or transforms function names as follows:
Before:
char MY_Function_string();
After:
char pre_my_function_string_post();
- GetConfigPerFile¶
When
true, the check will look for the configuration for where an identifier is declared. Useful for when included header files use a different style. Default istrue.
- GlobalConstexprVariableCase¶
When defined, the check will ensure global
constexprvariable names conform to the selected casing.
- GlobalConstexprVariablePrefix¶
When defined, the check will ensure global
constexprvariable names will add the prefixed with the given value (regardless of casing).
- GlobalConstexprVariableIgnoredRegexp¶
Identifier naming checks won’t be enforced for global
constexprvariable names matching this regular expression.
- GlobalConstexprVariableSuffix¶
When defined, the check will ensure global
constexprvariable names will add the suffix with the given value (regardless of casing).
- GlobalConstexprVariableHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
GlobalConstexprVariableCaseoflower_caseGlobalConstexprVariablePrefixofpre_GlobalConstexprVariableSuffixof_post
Identifies and/or transforms global constexpr variable names as follows:
Before:
constexpr unsigned ImportantValue = 69;
After:
constexpr unsigned pre_important_value_post = 69;
- GlobalConstantCase¶
When defined, the check will ensure global constant names conform to the selected casing.
- GlobalConstantPrefix¶
When defined, the check will ensure global constant names will add the prefix with the given value (regardless of casing).
- GlobalConstantIgnoredRegexp¶
Identifier naming checks won’t be enforced for global constant names matching this regular expression.
- GlobalConstantSuffix¶
When defined, the check will ensure global constant names will add the suffix with the given value (regardless of casing).
- GlobalConstantHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
GlobalConstantCaseoflower_caseGlobalConstantPrefixofpre_GlobalConstantSuffixof_post
Identifies and/or transforms global constant names as follows:
Before:
unsigned const MyConstGlobal_array[] = {1, 2, 3};
After:
unsigned const pre_myconstglobal_array_post[] = {1, 2, 3};
- GlobalConstantPointerCase¶
When defined, the check will ensure global constant pointer names conform to the selected casing.
- GlobalConstantPointerPrefix¶
When defined, the check will ensure global constant pointer names will add the prefix with the given value (regardless of casing).
- GlobalConstantPointerIgnoredRegexp¶
Identifier naming checks won’t be enforced for global constant pointer names matching this regular expression.
- GlobalConstantPointerSuffix¶
When defined, the check will ensure global constant pointer names will add the suffix with the given value (regardless of casing).
- GlobalConstantPointerHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
GlobalConstantPointerCaseoflower_caseGlobalConstantPointerPrefixofpre_GlobalConstantPointerSuffixof_post
Identifies and/or transforms global constant pointer names as follows:
Before:
int *const MyConstantGlobalPointer = nullptr;
After:
int *const pre_myconstantglobalpointer_post = nullptr;
- GlobalFunctionCase¶
When defined, the check will ensure global function names conform to the selected casing.
- GlobalFunctionPrefix¶
When defined, the check will ensure global function names will add the prefix with the given value (regardless of casing).
- GlobalFunctionIgnoredRegexp¶
Identifier naming checks won’t be enforced for global function names matching this regular expression.
- GlobalFunctionSuffix¶
When defined, the check will ensure global function names will add the suffix with the given value (regardless of casing).
For example using values of:
GlobalFunctionCaseoflower_caseGlobalFunctionPrefixofpre_GlobalFunctionSuffixof_post
Identifies and/or transforms global function names as follows:
Before:
void GLOBAL_FUNCTION(int PARAMETER_1, int const CONST_parameter);
After:
void pre_global_function_post(int PARAMETER_1, int const CONST_parameter);
- GlobalPointerCase¶
When defined, the check will ensure global pointer names conform to the selected casing.
- GlobalPointerPrefix¶
When defined, the check will ensure global pointer names will add the prefix with the given value (regardless of casing).
- GlobalPointerIgnoredRegexp¶
Identifier naming checks won’t be enforced for global pointer names matching this regular expression.
- GlobalPointerSuffix¶
When defined, the check will ensure global pointer names will add the suffix with the given value (regardless of casing).
- GlobalPointerHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
GlobalPointerCaseoflower_caseGlobalPointerPrefixofpre_GlobalPointerSuffixof_post
Identifies and/or transforms global pointer names as follows:
Before:
int *GLOBAL3;
After:
int *pre_global3_post;
- GlobalVariableCase¶
When defined, the check will ensure global variable names conform to the selected casing.
- GlobalVariablePrefix¶
When defined, the check will ensure global variable names will add the prefix with the given value (regardless of casing).
- GlobalVariableIgnoredRegexp¶
Identifier naming checks won’t be enforced for global variable names matching this regular expression.
- GlobalVariableSuffix¶
When defined, the check will ensure global variable names will add the suffix with the given value (regardless of casing).
- GlobalVariableHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
GlobalVariableCaseoflower_caseGlobalVariablePrefixofpre_GlobalVariableSuffixof_post
Identifies and/or transforms global variable names as follows:
Before:
int GLOBAL3;
After:
int pre_global3_post;
- IgnoreMainLikeFunctions¶
When
true, functions that have a similar signature tomainorwmainwon’t enforce checks on the names of their parameters. Default isfalse.
- InlineNamespaceCase¶
When defined, the check will ensure inline namespaces names conform to the selected casing.
- InlineNamespacePrefix¶
When defined, the check will ensure inline namespaces names will add the prefix with the given value (regardless of casing).
- InlineNamespaceIgnoredRegexp¶
Identifier naming checks won’t be enforced for inline namespaces names matching this regular expression.
- InlineNamespaceSuffix¶
When defined, the check will ensure inline namespaces names will add the suffix with the given value (regardless of casing).
For example using values of:
InlineNamespaceCaseoflower_caseInlineNamespacePrefixofpre_InlineNamespaceSuffixof_post
Identifies and/or transforms inline namespaces names as follows:
Before:
namespace FOO_NS {
inline namespace InlineNamespace {
...
}
} // namespace FOO_NS
After:
namespace FOO_NS {
inline namespace pre_inlinenamespace_post {
...
}
} // namespace FOO_NS
- LambdaCaptureCase¶
When defined, the check will ensure lambda init-capture names (e.g.
Capturedin[Captured = Var]) conform to the selected casing. A simple, non-init capture (e.g.[Var]or[&Var]) refers to the same declaration asVaritself, so it keeps following whichever naming style applies toVar’s own declaration instead.
- LambdaCapturePrefix¶
When defined, the check will ensure lambda init-capture names will add the prefix with the given value (regardless of casing).
- LambdaCaptureIgnoredRegexp¶
Identifier naming checks won’t be enforced for lambda init-capture names matching this regular expression.
- LambdaCaptureSuffix¶
When defined, the check will ensure lambda init-capture names will add the suffix with the given value (regardless of casing).
- LambdaCaptureHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
LambdaCaptureCaseofCamelCaseLambdaCapturePrefixofc_
Identifies and/or transforms lambda init-capture names as follows:
Before:
void foo() {
int local_variable = 0;
auto lambda = [captured_value = local_variable]() {
return captured_value;
};
}
After:
void foo() {
int local_variable = 0;
auto lambda = [c_CapturedValue = local_variable]() {
return c_CapturedValue;
};
}
- LocalConstexprVariableCase¶
When defined, the check will ensure local
constexprvariable names conform to the selected casing.
- LocalConstexprVariablePrefix¶
When defined, the check will ensure local
constexprvariable names will add the prefixed with the given value (regardless of casing).
- LocalConstexprVariableIgnoredRegexp¶
Identifier naming checks won’t be enforced for local
constexprvariable names matching this regular expression.
- LocalConstexprVariableSuffix¶
When defined, the check will ensure local
constexprvariable names will add the suffix with the given value (regardless of casing).
- LocalConstexprVariableHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
LocalConstexprVariableCaseoflower_caseLocalConstexprVariablePrefixofpre_LocalConstexprVariableSuffixof_post
Identifies and/or transforms local constexpr variable names as follows:
Before:
void foo() { int const local_Constexpr = 420; }
After:
void foo() { int const pre_local_constexpr_post = 420; }
- LocalConstantCase¶
When defined, the check will ensure local constant names conform to the selected casing.
- LocalConstantPrefix¶
When defined, the check will ensure local constant names will add the prefix with the given value (regardless of casing).
- LocalConstantIgnoredRegexp¶
Identifier naming checks won’t be enforced for local constant names matching this regular expression.
- LocalConstantSuffix¶
When defined, the check will ensure local constant names will add the suffix with the given value (regardless of casing).
- LocalConstantHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
LocalConstantCaseoflower_caseLocalConstantPrefixofpre_LocalConstantSuffixof_post
Identifies and/or transforms local constant names as follows:
Before:
void foo() { int const local_Constant = 3; }
After:
void foo() { int const pre_local_constant_post = 3; }
- LocalConstantPointerCase¶
When defined, the check will ensure local constant pointer names conform to the selected casing.
- LocalConstantPointerPrefix¶
When defined, the check will ensure local constant pointer names will add the prefix with the given value (regardless of casing).
- LocalConstantPointerIgnoredRegexp¶
Identifier naming checks won’t be enforced for local constant pointer names matching this regular expression.
- LocalConstantPointerSuffix¶
When defined, the check will ensure local constant pointer names will add the suffix with the given value (regardless of casing).
- LocalConstantPointerHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
LocalConstantPointerCaseoflower_caseLocalConstantPointerPrefixofpre_LocalConstantPointerSuffixof_post
Identifies and/or transforms local constant pointer names as follows:
Before:
void foo() { int const *local_Constant = 3; }
After:
void foo() { int const *pre_local_constant_post = 3; }
- LocalPointerCase¶
When defined, the check will ensure local pointer names conform to the selected casing.
- LocalPointerPrefix¶
When defined, the check will ensure local pointer names will add the prefix with the given value (regardless of casing).
- LocalPointerIgnoredRegexp¶
Identifier naming checks won’t be enforced for local pointer names matching this regular expression.
- LocalPointerSuffix¶
When defined, the check will ensure local pointer names will add the suffix with the given value (regardless of casing).
- LocalPointerHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
LocalPointerCaseoflower_caseLocalPointerPrefixofpre_LocalPointerSuffixof_post
Identifies and/or transforms local pointer names as follows:
Before:
void foo() { int *local_Constant; }
After:
void foo() { int *pre_local_constant_post; }
- LocalVariableCase¶
When defined, the check will ensure local variable names conform to the selected casing.
- LocalVariablePrefix¶
When defined, the check will ensure local variable names will add the prefix with the given value (regardless of casing).
- LocalVariableIgnoredRegexp¶
Identifier naming checks won’t be enforced for local variable names matching this regular expression.
For example using values of:
LocalVariableCaseofCamelCaseLocalVariableIgnoredRegexpof\w{1,2}
Will exclude variables with a length less than or equal to 2 from the camel case check applied to other variables.
- LocalVariableSuffix¶
When defined, the check will ensure local variable names will add the suffix with the given value (regardless of casing).
- LocalVariableHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
LocalVariableCaseoflower_caseLocalVariablePrefixofpre_LocalVariableSuffixof_post
Identifies and/or transforms local variable names as follows:
Before:
void foo() { int local_Constant; }
After:
void foo() { int pre_local_constant_post; }
- MacroDefinitionCase¶
When defined, the check will ensure macro definitions conform to the selected casing.
- MacroDefinitionPrefix¶
When defined, the check will ensure macro definitions will add the prefix with the given value (regardless of casing).
- MacroDefinitionIgnoredRegexp¶
Identifier naming checks won’t be enforced for macro definitions matching this regular expression.
- MacroDefinitionSuffix¶
When defined, the check will ensure macro definitions will add the suffix with the given value (regardless of casing).
For example using values of:
MacroDefinitionCaseoflower_caseMacroDefinitionPrefixofpre_MacroDefinitionSuffixof_post
Identifies and/or transforms macro definitions as follows:
Before:
#define MY_MacroDefinition
After:
#define pre_my_macro_definition_post
Note: This will not warn on builtin macros or macros defined on the
command line using the -D flag.
- MemberCase¶
When defined, the check will ensure member names conform to the selected casing.
- MemberPrefix¶
When defined, the check will ensure member names will add the prefix with the given value (regardless of casing).
- MemberIgnoredRegexp¶
Identifier naming checks won’t be enforced for member names matching this regular expression.
- MemberSuffix¶
When defined, the check will ensure member names will add the suffix with the given value (regardless of casing).
- MemberHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
MemberCaseoflower_caseMemberPrefixofpre_MemberSuffixof_postMemberHungarianPrefixofOn
Identifies and/or transforms member names as follows:
Before:
class Foo {
char MY_ConstMember_string[4];
}
After:
class Foo {
char pre_my_constmember_string_post[4];
}
- MethodCase¶
When defined, the check will ensure method names conform to the selected casing.
- MethodPrefix¶
When defined, the check will ensure method names will add the prefix with the given value (regardless of casing).
- MethodIgnoredRegexp¶
Identifier naming checks won’t be enforced for method names matching this regular expression.
- MethodSuffix¶
When defined, the check will ensure method names will add the suffix with the given value (regardless of casing).
For example using values of:
MethodCaseoflower_caseMethodPrefixofpre_MethodSuffixof_post
Identifies and/or transforms method names as follows:
Before:
class Foo {
char MY_Method_string();
}
After:
class Foo {
char pre_my_method_string_post();
}
- NamespaceCase¶
When defined, the check will ensure namespace names conform to the selected casing.
- NamespacePrefix¶
When defined, the check will ensure namespace names will add the prefix with the given value (regardless of casing).
- NamespaceIgnoredRegexp¶
Identifier naming checks won’t be enforced for namespace names matching this regular expression.
- NamespaceSuffix¶
When defined, the check will ensure namespace names will add the suffix with the given value (regardless of casing).
For example using values of:
NamespaceCaseoflower_caseNamespacePrefixofpre_NamespaceSuffixof_post
Identifies and/or transforms namespace names as follows:
Before:
namespace FOO_NS {
...
}
After:
namespace pre_foo_ns_post {
...
}
- ParameterCase¶
When defined, the check will ensure parameter names conform to the selected casing.
- ParameterPrefix¶
When defined, the check will ensure parameter names will add the prefix with the given value (regardless of casing).
- ParameterIgnoredRegexp¶
Identifier naming checks won’t be enforced for parameter names matching this regular expression.
- ParameterSuffix¶
When defined, the check will ensure parameter names will add the suffix with the given value (regardless of casing).
- ParameterHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ParameterCaseoflower_caseParameterPrefixofpre_ParameterSuffixof_postParameterHungarianPrefixofOn
Identifies and/or transforms parameter names as follows:
Before:
void GLOBAL_FUNCTION(int PARAMETER_1, int const CONST_parameter);
After:
void GLOBAL_FUNCTION(int pre_parameter_post, int const CONST_parameter);
- ParameterPackCase¶
When defined, the check will ensure parameter pack names conform to the selected casing.
- ParameterPackPrefix¶
When defined, the check will ensure parameter pack names will add the prefix with the given value (regardless of casing).
- ParameterPackIgnoredRegexp¶
Identifier naming checks won’t be enforced for parameter pack names matching this regular expression.
- ParameterPackSuffix¶
When defined, the check will ensure parameter pack names will add the suffix with the given value (regardless of casing).
For example using values of:
ParameterPackCaseoflower_caseParameterPackPrefixofpre_ParameterPackSuffixof_post
Identifies and/or transforms parameter pack names as follows:
Before:
template <typename... TYPE_parameters> {
void FUNCTION(int... TYPE_parameters);
}
After:
template <typename... TYPE_parameters> {
void FUNCTION(int... pre_type_parameters_post);
}
- PointerParameterCase¶
When defined, the check will ensure pointer parameter names conform to the selected casing.
- PointerParameterPrefix¶
When defined, the check will ensure pointer parameter names will add the prefix with the given value (regardless of casing).
- PointerParameterIgnoredRegexp¶
Identifier naming checks won’t be enforced for pointer parameter names matching this regular expression.
- PointerParameterSuffix¶
When defined, the check will ensure pointer parameter names will add the suffix with the given value (regardless of casing).
- PointerParameterHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
PointerParameterCaseoflower_casePointerParameterPrefixofpre_PointerParameterSuffixof_post
Identifies and/or transforms pointer parameter names as follows:
Before:
void FUNCTION(int *PARAMETER);
After:
void FUNCTION(int *pre_parameter_post);
- PrivateMemberCase¶
When defined, the check will ensure private member names conform to the selected casing.
- PrivateMemberPrefix¶
When defined, the check will ensure private member names will add the prefix with the given value (regardless of casing).
- PrivateMemberIgnoredRegexp¶
Identifier naming checks won’t be enforced for private member names matching this regular expression.
- PrivateMemberSuffix¶
When defined, the check will ensure private member names will add the suffix with the given value (regardless of casing).
- PrivateMemberHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
PrivateMemberCaseoflower_casePrivateMemberPrefixofpre_PrivateMemberSuffixof_post
Identifies and/or transforms private member names as follows:
Before:
class Foo {
private:
int Member_Variable;
}
After:
class Foo {
private:
int pre_member_variable_post;
}
- PrivateMethodCase¶
When defined, the check will ensure private method names conform to the selected casing.
- PrivateMethodPrefix¶
When defined, the check will ensure private method names will add the prefix with the given value (regardless of casing).
- PrivateMethodIgnoredRegexp¶
Identifier naming checks won’t be enforced for private method names matching this regular expression.
- PrivateMethodSuffix¶
When defined, the check will ensure private method names will add the suffix with the given value (regardless of casing).
For example using values of:
PrivateMethodCaseoflower_casePrivateMethodPrefixofpre_PrivateMethodSuffixof_post
Identifies and/or transforms private method names as follows:
Before:
class Foo {
private:
int Member_Method();
}
After:
class Foo {
private:
int pre_member_method_post();
}
- ProtectedMemberCase¶
When defined, the check will ensure protected member names conform to the selected casing.
- ProtectedMemberPrefix¶
When defined, the check will ensure protected member names will add the prefix with the given value (regardless of casing).
- ProtectedMemberIgnoredRegexp¶
Identifier naming checks won’t be enforced for protected member names matching this regular expression.
- ProtectedMemberSuffix¶
When defined, the check will ensure protected member names will add the suffix with the given value (regardless of casing).
- ProtectedMemberHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ProtectedMemberCaseoflower_caseProtectedMemberPrefixofpre_ProtectedMemberSuffixof_post
Identifies and/or transforms protected member names as follows:
Before:
class Foo {
protected:
int Member_Variable;
}
After:
class Foo {
protected:
int pre_member_variable_post;
}
- ProtectedMethodCase¶
When defined, the check will ensure protected method names conform to the selected casing.
- ProtectedMethodPrefix¶
When defined, the check will ensure protected method names will add the prefix with the given value (regardless of casing).
- ProtectedMethodIgnoredRegexp¶
Identifier naming checks won’t be enforced for protected method names matching this regular expression.
- ProtectedMethodSuffix¶
When defined, the check will ensure protected method names will add the suffix with the given value (regardless of casing).
For example using values of:
ProtectedMethodCaseoflower_caseProtectedMethodPrefixofpre_ProtectedMethodSuffixof_post
Identifies and/or transforms protect method names as follows:
Before:
class Foo {
protected:
int Member_Method();
}
After:
class Foo {
protected:
int pre_member_method_post();
}
- PublicMemberCase¶
When defined, the check will ensure public member names conform to the selected casing.
- PublicMemberPrefix¶
When defined, the check will ensure public member names will add the prefix with the given value (regardless of casing).
- PublicMemberIgnoredRegexp¶
Identifier naming checks won’t be enforced for public member names matching this regular expression.
- PublicMemberSuffix¶
When defined, the check will ensure public member names will add the suffix with the given value (regardless of casing).
- PublicMemberHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
PublicMemberCaseoflower_casePublicMemberPrefixofpre_PublicMemberSuffixof_post
Identifies and/or transforms public member names as follows:
Before:
class Foo {
public:
int Member_Variable;
}
After:
class Foo {
public:
int pre_member_variable_post;
}
- PublicMethodCase¶
When defined, the check will ensure public method names conform to the selected casing.
- PublicMethodPrefix¶
When defined, the check will ensure public method names will add the prefix with the given value (regardless of casing).
- PublicMethodIgnoredRegexp¶
Identifier naming checks won’t be enforced for public method names matching this regular expression.
- PublicMethodSuffix¶
When defined, the check will ensure public method names will add the suffix with the given value (regardless of casing).
For example using values of:
PublicMethodCaseoflower_casePublicMethodPrefixofpre_PublicMethodSuffixof_post
Identifies and/or transforms public method names as follows:
Before:
class Foo {
public:
int Member_Method();
}
After:
class Foo {
public:
int pre_member_method_post();
}
- ScopedEnumConstantCase¶
When defined, the check will ensure scoped enum constant names conform to the selected casing.
- ScopedEnumConstantPrefix¶
When defined, the check will ensure scoped enum constant names will add the prefix with the given value (regardless of casing).
- ScopedEnumConstantIgnoredRegexp¶
Identifier naming checks won’t be enforced for scoped enum constant names matching this regular expression.
- ScopedEnumConstantSuffix¶
When defined, the check will ensure scoped enum constant names will add the suffix with the given value (regardless of casing).
- ScopedEnumConstantHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
ScopedEnumConstantCaseoflower_caseScopedEnumConstantPrefixofpre_ScopedEnumConstantSuffixof_post
Identifies and/or transforms enumeration constant names as follows:
Before:
enum class FOO { One, Two, Three };
After:
enum class FOO { pre_One_post, pre_Two_post, pre_Three_post };
- StaticConstexprVariableCase¶
When defined, the check will ensure static
constexprvariable names conform to the selected casing.
- StaticConstexprVariablePrefix¶
When defined, the check will ensure static
constexprvariable names will add the prefixed with the given value (regardless of casing).
- StaticConstexprVariableIgnoredRegexp¶
Identifier naming checks won’t be enforced for static
constexprvariable names matching this regular expression.
- StaticConstexprVariableSuffix¶
When defined, the check will ensure static
constexprvariable names will add the suffix with the given value (regardless of casing).
- StaticConstexprVariableHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
StaticConstexprVariableCaseoflower_caseStaticConstexprVariablePrefixofpre_StaticConstexprVariableSuffixof_post
Identifies and/or transforms static constexpr variable names as follows:
Before:
static unsigned constexpr MyConstexprStatic_array[] = {1, 2, 3};
After:
static unsigned constexpr pre_my_constexpr_static_array_post[] = {1, 2, 3};
- StaticConstantCase¶
When defined, the check will ensure static constant names conform to the selected casing.
- StaticConstantPrefix¶
When defined, the check will ensure static constant names will add the prefix with the given value (regardless of casing).
- StaticConstantIgnoredRegexp¶
Identifier naming checks won’t be enforced for static constant names matching this regular expression.
- StaticConstantSuffix¶
When defined, the check will ensure static constant names will add the suffix with the given value (regardless of casing).
- StaticConstantHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
StaticConstantCaseoflower_caseStaticConstantPrefixofpre_StaticConstantSuffixof_post
Identifies and/or transforms static constant names as follows:
Before:
static unsigned const MyConstStatic_array[] = {1, 2, 3};
After:
static unsigned const pre_myconststatic_array_post[] = {1, 2, 3};
- StaticVariableCase¶
When defined, the check will ensure static variable names conform to the selected casing.
- StaticVariablePrefix¶
When defined, the check will ensure static variable names will add the prefix with the given value (regardless of casing).
- StaticVariableIgnoredRegexp¶
Identifier naming checks won’t be enforced for static variable names matching this regular expression.
- StaticVariableSuffix¶
When defined, the check will ensure static variable names will add the suffix with the given value (regardless of casing).
- StaticVariableHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
StaticVariableCaseoflower_caseStaticVariablePrefixofpre_StaticVariableSuffixof_post
Identifies and/or transforms static variable names as follows:
Before:
static unsigned MyStatic_array[] = {1, 2, 3};
After:
static unsigned pre_mystatic_array_post[] = {1, 2, 3};
- StructCase¶
When defined, the check will ensure struct names conform to the selected casing.
- StructPrefix¶
When defined, the check will ensure struct names will add the prefix with the given value (regardless of casing).
- StructIgnoredRegexp¶
Identifier naming checks won’t be enforced for struct names matching this regular expression.
- StructSuffix¶
When defined, the check will ensure struct names will add the suffix with the given value (regardless of casing).
For example using values of:
StructCaseoflower_caseStructPrefixofpre_StructSuffixof_post
Identifies and/or transforms struct names as follows:
Before:
struct FOO {
FOO();
~FOO();
};
After:
struct pre_foo_post {
pre_foo_post();
~pre_foo_post();
};
- TemplateParameterCase¶
When defined, the check will ensure template parameter names conform to the selected casing.
- TemplateParameterPrefix¶
When defined, the check will ensure template parameter names will add the prefix with the given value (regardless of casing).
- TemplateParameterIgnoredRegexp¶
Identifier naming checks won’t be enforced for template parameter names matching this regular expression.
- TemplateParameterSuffix¶
When defined, the check will ensure template parameter names will add the suffix with the given value (regardless of casing).
For example using values of:
TemplateParameterCaseoflower_caseTemplateParameterPrefixofpre_TemplateParameterSuffixof_post
Identifies and/or transforms template parameter names as follows:
Before:
template <typename T> class Foo {};
After:
template <typename pre_t_post> class Foo {};
- TemplateTemplateParameterCase¶
When defined, the check will ensure template template parameter names conform to the selected casing.
- TemplateTemplateParameterPrefix¶
When defined, the check will ensure template template parameter names will add the prefix with the given value (regardless of casing).
- TemplateTemplateParameterIgnoredRegexp¶
Identifier naming checks won’t be enforced for template template parameter names matching this regular expression.
- TemplateTemplateParameterSuffix¶
When defined, the check will ensure template template parameter names will add the suffix with the given value (regardless of casing).
For example using values of:
TemplateTemplateParameterCaseoflower_caseTemplateTemplateParameterPrefixofpre_TemplateTemplateParameterSuffixof_post
Identifies and/or transforms template template parameter names as follows:
Before:
template <template <typename> class TPL_parameter, int COUNT_params,
typename... TYPE_parameters>
After:
template <template <typename> class pre_tpl_parameter_post, int COUNT_params,
typename... TYPE_parameters>
- TypeAliasCase¶
When defined, the check will ensure type alias names conform to the selected casing.
- TypeAliasPrefix¶
When defined, the check will ensure type alias names will add the prefix with the given value (regardless of casing).
- TypeAliasIgnoredRegexp¶
Identifier naming checks won’t be enforced for type alias names matching this regular expression.
- TypeAliasSuffix¶
When defined, the check will ensure type alias names will add the suffix with the given value (regardless of casing).
For example using values of:
TypeAliasCaseoflower_caseTypeAliasPrefixofpre_TypeAliasSuffixof_post
Identifies and/or transforms type alias names as follows:
Before:
using MY_STRUCT_TYPE = my_structure;
After:
using pre_my_struct_type_post = my_structure;
- TypedefCase¶
When defined, the check will ensure typedef names conform to the selected casing.
- TypedefPrefix¶
When defined, the check will ensure typedef names will add the prefix with the given value (regardless of casing).
- TypedefIgnoredRegexp¶
Identifier naming checks won’t be enforced for typedef names matching this regular expression.
- TypedefSuffix¶
When defined, the check will ensure typedef names will add the suffix with the given value (regardless of casing).
For example using values of:
TypedefCaseoflower_caseTypedefPrefixofpre_TypedefSuffixof_post
Identifies and/or transforms typedef names as follows:
Before:
typedef int MYINT;
After:
typedef int pre_myint_post;
- TypedefInheritAnonTagConfig¶
When
true, a typedef or type alias that provides the only name of an otherwise unnamed tag, as intypedef enum {} MyEnum;, is checked against the naming style configured for the kind of that tag (AbstractClass,Class,Enum,StructorUnion, i.e.EnumCase,EnumPrefix,EnumSuffixandEnumIgnoredRegexpfor an enum) rather than against the typedef or type alias style. If that kind configures no case, prefix or suffix, the typedef or type alias style still applies. Typedefs of named tags, of other typedefs and of non-tag types are not affected. Default isfalse.
For example using values of:
TypedefInheritAnonTagConfigoftrueEnumCaseofCamelCaseTypedefCaseoflower_case
Identifies and/or transforms names as follows:
Before:
typedef enum { VAL } my_enum; // The typedef names the enum.
typedef enum Kind { VAL2 } my_kind; // Kind names the enum.
After:
typedef enum { VAL } MyEnum;
typedef enum Kind { VAL2 } my_kind;
- TypeTemplateParameterCase¶
When defined, the check will ensure type template parameter names conform to the selected casing.
- TypeTemplateParameterPrefix¶
When defined, the check will ensure type template parameter names will add the prefix with the given value (regardless of casing).
- TypeTemplateParameterIgnoredRegexp¶
Identifier naming checks won’t be enforced for type template names matching this regular expression.
- TypeTemplateParameterSuffix¶
When defined, the check will ensure type template parameter names will add the suffix with the given value (regardless of casing).
For example using values of:
TypeTemplateParameterCaseoflower_caseTypeTemplateParameterPrefixofpre_TypeTemplateParameterSuffixof_post
Identifies and/or transforms type template parameter names as follows:
Before:
template <template <typename> class TPL_parameter, int COUNT_params,
typename... TYPE_parameters>
After:
template <template <typename> class TPL_parameter, int COUNT_params,
typename... pre_type_parameters_post>
- UnionCase¶
When defined, the check will ensure union names conform to the selected casing.
- UnionPrefix¶
When defined, the check will ensure union names will add the prefix with the given value (regardless of casing).
- UnionIgnoredRegexp¶
Identifier naming checks won’t be enforced for union names matching this regular expression.
- UnionSuffix¶
When defined, the check will ensure union names will add the suffix with the given value (regardless of casing).
For example using values of:
UnionCaseoflower_caseUnionPrefixofpre_UnionSuffixof_post
Identifies and/or transforms union names as follows:
Before:
union FOO {
int a;
char b;
};
After:
union pre_foo_post {
int a;
char b;
};
- ValueTemplateParameterCase¶
When defined, the check will ensure value template parameter names conform to the selected casing.
- ValueTemplateParameterPrefix¶
When defined, the check will ensure value template parameter names will add the prefix with the given value (regardless of casing).
- ValueTemplateParameterIgnoredRegexp¶
Identifier naming checks won’t be enforced for value template parameter names matching this regular expression.
- ValueTemplateParameterSuffix¶
When defined, the check will ensure value template parameter names will add the suffix with the given value (regardless of casing).
For example using values of:
ValueTemplateParameterCaseoflower_caseValueTemplateParameterPrefixofpre_ValueTemplateParameterSuffixof_post
Identifies and/or transforms value template parameter names as follows:
Before:
template <template <typename> class TPL_parameter, int COUNT_params,
typename... TYPE_parameters>
After:
template <template <typename> class TPL_parameter, int pre_count_params_post,
typename... TYPE_parameters>
- VariableCase¶
When defined, the check will ensure variable names conform to the selected casing.
- VariablePrefix¶
When defined, the check will ensure variable names will add the prefix with the given value (regardless of casing).
- VariableIgnoredRegexp¶
Identifier naming checks won’t be enforced for variable names matching this regular expression.
- VariableSuffix¶
When defined, the check will ensure variable names will add the suffix with the given value (regardless of casing).
- VariableHungarianPrefix¶
When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.
For example using values of:
VariableCaseoflower_caseVariablePrefixofpre_VariableSuffixof_postVariableHungarianPrefixofOn
Identifies and/or transforms variable names as follows:
Before:
unsigned MyVariable;
After:
unsigned pre_myvariable_post;
- VirtualMethodCase¶
When defined, the check will ensure virtual method names conform to the selected casing.
- VirtualMethodPrefix¶
When defined, the check will ensure virtual method names will add the prefix with the given value (regardless of casing).
- VirtualMethodIgnoredRegexp¶
Identifier naming checks won’t be enforced for virtual method names matching this regular expression.
- VirtualMethodSuffix¶
When defined, the check will ensure virtual method names will add the suffix with the given value (regardless of casing).
For example using values of:
VirtualMethodCaseoflower_caseVirtualMethodPrefixofpre_VirtualMethodSuffixof_post
Identifies and/or transforms virtual method names as follows:
Before:
class Foo {
public:
virtual int MemberFunction();
}
After:
class Foo {
public:
virtual int pre_member_function_post();
}
The default mapping table of Hungarian Notation¶
In Hungarian notation, a variable name starts with a group of lower-case letters which are mnemonics for the type or purpose of that variable, followed by whatever name the programmer has chosen; this last part is sometimes distinguished as the given name. The first character of the given name can be capitalized to separate it from the type indicators (see also CamelCase). Otherwise the case of this character denotes scope.
The following table maps type names to their default Hungarian notation prefixes. You can define custom mappings in the configuration file.
Primitive Type |
Microsoft Type |
||||
|---|---|---|---|---|---|
Type |
Prefix |
Type |
Prefix |
Type |
Prefix |
int8_t |
i8 |
signed int |
si |
BOOL |
b |
int16_t |
i16 |
signed short |
ss |
BOOLEAN |
b |
int32_t |
i32 |
signed short int |
ssi |
BYTE |
by |
int64_t |
i64 |
signed long long int |
slli |
CHAR |
c |
uint8_t |
u8 |
signed long long |
sll |
UCHAR |
uc |
uint16_t |
u16 |
signed long int |
sli |
SHORT |
s |
uint32_t |
u32 |
signed long |
sl |
USHORT |
us |
uint64_t |
u64 |
signed |
s |
WORD |
w |
char8_t |
c8 |
unsigned long long int |
ulli |
DWORD |
dw |
char16_t |
c16 |
unsigned long long |
ull |
DWORD32 |
dw32 |
char32_t |
c32 |
unsigned long int |
uli |
DWORD64 |
dw64 |
float |
f |
unsigned long |
ul |
LONG |
l |
double |
d |
unsigned short int |
usi |
ULONG |
ul |
char |
c |
unsigned short |
us |
ULONG32 |
ul32 |
bool |
b |
unsigned int |
ui |
ULONG64 |
ul64 |
_Bool |
b |
unsigned char |
uc |
ULONGLONG |
ull |
int |
i |
unsigned |
u |
HANDLE |
h |
size_t |
n |
long long int |
lli |
INT |
i |
short |
s |
long double |
ld |
INT8 |
i8 |
signed |
i |
long long |
ll |
INT16 |
i16 |
unsigned |
u |
long int |
li |
INT32 |
i32 |
long |
l |
long |
l |
INT64 |
i64 |
long long |
ll |
ptrdiff_t |
p |
UINT |
ui |
unsigned long |
ul |
void |
none |
UINT8 |
u8 |
long double |
ld |
UINT16 |
u16 |
||
ptrdiff_t |
p |
UINT32 |
u32 |
||
wchar_t |
wc |
UINT64 |
u64 |
||
short int |
si |
PVOID |
p |
||
short |
s |
There are more trivial options for Hungarian Notation:
HungarianNotation.General.*: Options not belonging to any specific declaration.
HungarianNotation.CString.*: Options for null-terminated strings.
HungarianNotation.DerivedType.*: Options for derived types.
HungarianNotation.PrimitiveType.*: Options for primitive types.
HungarianNotation.UserDefinedType.*: Options for user-defined types.
Options for Hungarian Notation¶
- HungarianNotation.General.TreatStructAsClass¶
When defined, the check will treat naming of struct as a class. Default is
false.
- HungarianNotation.DerivedType.Array¶
When defined, the check will ensure variable name will add the prefix with the given string. Default is
a.
- HungarianNotation.DerivedType.Pointer¶
When defined, the check will ensure variable name will add the prefix with the given string. Default is
p.
- HungarianNotation.DerivedType.FunctionPointer¶
When defined, the check will ensure variable name will add the prefix with the given string. Default is
fn.
Before:
// Array
int DataArray[2] = {0};
// Pointer
void *DataBuffer = NULL;
// FunctionPointer
typedef void (*FUNC_PTR)();
FUNC_PTR FuncPtr = NULL;
After:
// Array
int aDataArray[2] = {0};
// Pointer
void *pDataBuffer = NULL;
// FunctionPointer
typedef void (*FUNC_PTR)();
FUNC_PTR fnFuncPtr = NULL;
- HungarianNotation.CString.CharPointer¶
When defined, the check will ensure variable name will add the prefix with the given string. Default is
sz.
- HungarianNotation.CString.CharArray¶
When defined, the check will ensure variable name will add the prefix with the given string. Default is
sz.
- HungarianNotation.CString.WideCharPointer¶
When defined, the check will ensure variable name will add the prefix with the given string. Default is
wsz.
- HungarianNotation.CString.WideCharArray¶
When defined, the check will ensure variable name will add the prefix with the given string. Default is
wsz.
Before:
// CharPointer
const char *NamePtr = "Name";
// CharArray
const char NameArray[] = "Name";
// WideCharPointer
const wchar_t *WideNamePtr = L"Name";
// WideCharArray
const wchar_t WideNameArray[] = L"Name";
After:
// CharPointer
const char *szNamePtr = "Name";
// CharArray
const char szNameArray[] = "Name";
// WideCharPointer
const wchar_t *wszWideNamePtr = L"Name";
// WideCharArray
const wchar_t wszWideNameArray[] = L"Name";
- HungarianNotation.PrimitiveType.*¶
When defined, the check will ensure variable name of involved primitive types will add the prefix with the given string. The default prefixes are defined in the default mapping table.
- HungarianNotation.UserDefinedType.*¶
When defined, the check will ensure variable name of involved user-defined types will add the prefix with the given string. The default prefixes are defined in the default mapping table.
Before:
int8_t ValueI8 = 0;
int16_t ValueI16 = 0;
int32_t ValueI32 = 0;
int64_t ValueI64 = 0;
uint8_t ValueU8 = 0;
uint16_t ValueU16 = 0;
uint32_t ValueU32 = 0;
uint64_t ValueU64 = 0;
float ValueFloat = 0.0;
double ValueDouble = 0.0;
ULONG ValueUlong = 0;
DWORD ValueDword = 0;
After:
int8_t i8ValueI8 = 0;
int16_t i16ValueI16 = 0;
int32_t i32ValueI32 = 0;
int64_t i64ValueI64 = 0;
uint8_t u8ValueU8 = 0;
uint16_t u16ValueU16 = 0;
uint32_t u32ValueU32 = 0;
uint64_t u64ValueU64 = 0;
float fValueFloat = 0.0;
double dValueDouble = 0.0;
ULONG ulValueUlong = 0;
DWORD dwValueDword = 0;