Explanation
Sharing some naming conventions is a key point to make it possible for a team to efficiently collaborate. This rule allows to check that all element names match a provided regular expression.
Using the default regex all element names have to comply with the following rules:
- Names should start with a capital letter
- Following letters can be lowercase or uppercase
- Element name is at least two characters long
This means numbers and special characters (including dashes and underscores) are not allowed in the default regex.
We estimate that resolving this issue will on average take 5 minutes.
Parameters
namingConvention | The regex that element names should comply with. Default value: ^[A-Z][a-zA-Z]+$ |
Example
The following examples use the default naming convention.
Compliant:
- ElementName
- EN
- ELEMENTNAME
Non compliant:
- elementName
- ElementName1
- Element_name
- E
User suggested regex
Some of our customers use other regular expressions in their project, which you are very much allowed to. A suggestion we got was the following expression:
Regex | The idea | Example of compliant | Example of Non compliant |
---|---|---|---|
^(?:(?!.*((?i)temp|tmp|test))([A-Z][A-z_]+?))$ | Disallow certain sub-strings (temp, tmp, test) and allow the _ character | CalculateInterestRate_Annuity | GetValuesFor_Temp_Profile_Input |