Miscellaneous-NamingConvention¶
Check named entities against naming conventions
Required inputs: IR
For example, in the default configuration, this rule will check:
- Const data member must be all upper-case
- Const global variable must be all upper-case
- Data member must be all lower-case
- Data member of a class must start with "m_"
- Enumeration type must use camel-case, starting with upper-case letter
- Enumerator must be all upper-case
- Enumerators must start with common prefix
- Function must be all lower-case
- Global variable must be all lowercase and start with g_
- Label must be all lower-case
- Local binding must be all lower-case
- Local variable must be all lower-case
- Macro must be all upper-case
- Namespace must be all lower-case
- Parameter must be all lower-case
- Private or protected function member must be prefixed by underscore, use camel-case, starting with lower-case character
- Public function member must use camel-case, starting with lower-case character
- Static data member must be all lower-case
- Static function member must be all lower-case
- Typedef type must use camel-case, starting with upper-case letter
- User-defined type must use camel-case, starting with upper-case letter
Possible Messages
This rule has no predefined messages.
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
excluded_global_functions¶
excluded_global_functions : set[bauhaus.analysis.config.FunctionName] = {'DllMain', 'WinMain', 'main', 'wWinMain', 'wmain'}
naming¶
naming
Each partial naming rule for the identifier of a certain node type has the following format: node_type_name : [ (checker, message), (checker, message), ... ] "checker" can be either a regular expression (in which case it must match the identifier) or a complex checker consisting of a guarding predicate (guard) and an regular expression (in which case the guard governs if the regexp must match). If a checker fails, its message is issued. All checkers in the list must match in order to get no message, i.e., if you want to state different regexps for different combinations of aspects (visibility etc), make sure the guards create the needed disjointness of your regexp checks. If multiple checkers fail for the same identifier, you will end up with multiple messages for that identifier. Some aspects are expressed by attributes (constness, visibility), some by the hierarchy (staticness).Type: dict[Part, dict[str, bauhaus.ir.common.names.named_nodes.CheckerList]]
Default:
{ 'Logical': { 'Composite_Type': [('^[A-Z][a-zA-Z0-9]*$', 'User-defined type must use camel-case, starting with upper-case letter')], 'Concept': [], 'Enumeration_Type': [('^[A-Z][a-zA-Z0-9]*$', 'Enumeration type must use camel-case, starting with upper-case letter'), (<function bauhaus.rules.axivion.style.naming.naming_convention.check_enumerators(node: bauhaus.ir.Node) -> bool>, 'Enumerators must start with common prefix')], 'Enumerator': [('^[A-Z][A-Z0-9_]*$', 'Enumerator must be all upper-case')], 'Field': [(<function bauhaus.rules.axivion.style.naming.naming_convention.checker(node: bauhaus.ir.Node) -> Union[bool, Match[str], NoneType]>, 'Data member must be all lower-case'), (<function bauhaus.rules.axivion.style.naming.naming_convention.checker(node: bauhaus.ir.Node) -> Union[bool, Match[str], NoneType]>, 'Const data member must be all upper-case'), (<function bauhaus.rules.axivion.style.naming.naming_convention.checker(node: bauhaus.ir.Node) -> Union[bool, Match[str], NoneType]>, 'Data member of a class must start with "m_"')], 'Function': [('^[a-z][a-z0-9_]*$', 'Function must be all lower-case')], 'General_Named_Union_Type': [], 'General_Typedef_Type': [], 'Global_Binding_Variable': [], 'Global_Normal_Variable': [], 'Global_Static_Variable': [], 'Global_Variable': [(<function bauhaus.rules.axivion.style.naming.naming_convention.checker(node: bauhaus.ir.Node) -> Union[bool, Match[str], NoneType]>, 'Global variable must be all lowercase and start with g_'), (<function bauhaus.rules.axivion.style.naming.naming_convention.checker(node: bauhaus.ir.Node) -> Union[bool, Match[str], NoneType]>, 'Const global variable must be all upper-case')], 'Local_Binding_Variable': [('^[a-z][a-z0-9_]*$', 'Local binding must be all lower-case')], 'Local_Normal_Variable': [], 'Local_Register_Variable': [], 'Local_Static_Variable': [], 'Local_Variable': [('^[a-z][a-z0-9_]*$', 'Local variable must be all lower-case')], 'Named_Namespace': [('^[a-z][a-z0-9_]*$', 'Namespace must be all lower-case')], 'Named_Record_Type': [], 'Named_Type': [], 'Nonstatic_Function': [], 'Normal_Method': [(<function bauhaus.rules.axivion.style.naming.naming_convention.checker(node: bauhaus.ir.Node) -> Union[bool, Match[str], NoneType]>, 'Private or protected function member must be prefixed by underscore, use camel-case, starting with lower-case character'), (<function bauhaus.rules.axivion.style.naming.naming_convention.checker(node: bauhaus.ir.Node) -> Union[bool, Match[str], NoneType]>, 'Public function member must use camel-case, starting with lower-case character')], 'Normal_Static_Method': [('^[a-z][a-z0-9_]*$', 'Static function member must be all lower-case')], 'Static_Field': [('^[a-z][a-z0-9_]*$', 'Static data member must be all lower-case')], 'Static_Function': [], 'Template_Const_Parameter': [], 'Template_Type_Parameter': [], 'Typedef_Type': [('^[A-Z][a-zA-Z0-9]*$', 'Typedef type must use camel-case, starting with upper-case letter')], 'Variable': [] }, 'Physical': { 'Macro_Definition': [('^[A-Z][A-Z0-9_]*$', 'Macro must be all upper-case')], 'Named_Label': [('^[a-z][a-z0-9_]*$', 'Label must be all lower-case')], 'Standard_Parameter_Definition': [('^[a-z][a-z0-9_]*$', 'Parameter must be all lower-case')] } }
Option Types¶
These types are used by options listed above:
Part¶
Enum used as type of config options. For all other tCommon
Logical
Physical
Build