Login
namingConv rule
Login

The rule check if the selected type of entries follow the selected naming convention. It can check variables, procedures and enumerations' values. The syntax in a configuration file is:

[ruleType] ?not? namingConv [entityType] [nameExpression]

Disabling the rule

It is possible to disable the rule for a selected part of the checked code by using pragma ruleOff: "namingConv" in the element from which the rule should be disabled or in code before it. For example, if the rule should be disabled for procedure proc main(), the full declaration of it should be:

proc main () {.ruleOff: "namingConv".}

To enable the rule again, the pragma ruleOn: "namingConv" should be added in the element which should be checked or in code before it. For example, if the rule should be re-enabled for const a = 1, the full declaration should be:

const a {.ruleOn: "namingConv".} = 1

Examples

  1. Check if names of variables follow standard Nim convention:

check namingConv variables [a-z][A-Z0-9_]*

  1. Find procedures which names ends with proc:

search namingConv procedures proc$

  1. Count enumerations which values are not start with enum:

count not namingConv enumerations ^enum