Naming conventions
Naming convention is a set of rules intended to unify all the symbol names across a piece of code or a project. Each naming rule defines the suffix, prefix, capitalization and compound words spelling for a certain type of identifier.
Note that you can also select the naming convention (along with other code style settings) from a predefined scheme, such as Google or LLVM. For more information, refer to Predefined code styles.
Configure naming rules
Open the Naming Convention tab in .
Specify naming settings for the entities in your code:
You can apply a rule for several entities at a time. Click the Entity Kind field and select multiple options:
In the Naming Convention field, select the spelling style:
lowercase
,camelCase
,PascalCase
,snake_case
,Leading_upper_snake_case
,Upper_Snake_Case
,SCREAMING_SNAKE_CASE
, orUPPERCASE
.You can also specify separate rules for particular types of some entities (for example, when you use specific naming for private/public class members or static/const variables). For this, set the Visibility and Specifier fields where applicable:
If required, specify Prefix and Suffix (for example,
'e_'
as a prefix for enums and't_'
for typedefs).
To save the configured style for the current project only, select Project in the Scheme switcher.
CLion will take naming convention settings into account when performing
code generation including live templates,
quick-fixes that include code generation (like add parameter to constructor, change function signature according to call and others),
Inspect code for violations of the naming rules
You can check your code for consistency with the configured naming convention by using the Inconsistent Naming inspection. By default, this inspection is disabled - to turn it on, go to .
When enabled, this inspection highlights the symbols that violate naming rules and suggests quick-fixes to instantly change them:
Also, you can run this inspection separately to check the entire code base or a subset of files. For this, run Code | Inspect Code or invoke the Run Inspection by Name dialog Ctrl+Alt+Shift+I and search for Inconsistent Naming. The results will be listed in the Inspection Results tool window: