Links

Examples of automatic suggestions configurations

The automatic suggestions are configured with regexes.
Regexes are applied to lines of code visible to developers in their IDEs and also in code review tools. They are applied on the whole visible lines and some before and after the visible ones.
The principles of these configurations are often the same. So you can use what is listed here as inspiration to set up your own practices.
​

Identify a specific keyword

The easiest one, you just have to use the keyword you want to find in the negative regex. If this keyword as to be replaced by another, use the right keyword as a positive regex.
Practice: "Use beforeEach to isolate your tests"
Negative regex: "before"
Postive regex: "beforeEach"
Extensions: As this practice is used only for tests files, you can use "spec." as extension value for each regex to let Promyze identify this practice only in tests files.
Order: As the negative regex will be identified in both "before" and "beforeEach" keywords, make sure that the the positive regex is the first in the list for Promyze to identify this practice as positive if the "beforeEach" keyword is found.
Once the positive AND negative regexes are created, click on the "Order regexes" button to change the priority order
Result:

Identify the absence of a keyword on multiple lines

Practice: "Buttons should always have a 'type' attribute"
Negative regex: "<button(((?!type).)*\n){0,5}</button>"
Result:
​