Configure automatic suggestions
Promyze's plugins, both for IDE and code review in Web Browsers, provide a feature of automatic suggestions of best practices.
Based on your context (the source code displayed in your IDE or the code shown in the Web browser during a code review), Promyze suggests Best practices that look not to be applied
To compute suggestions, you have to specify a regular expression.
In Promyze, select the practice on which you want to add a regular expression and click on the "Configure Automatic Suggestions" menu (bottom right of the modal).
Then, click on "+Add a regex configuration":
This will open this menu, where you have two main inputs in the form:
- an input to specify your regular expression
- an editor to test your expression against a source code
A switch button allow you to configure this regular expression for :
- "positive": create an expression that identifies if a best practice is followed
- "negative": create an expression that identifies if a best practice is not followed
If you have some existing examples in your best practice documentation, you'll find them listed below the editor. Just click on one of them to fill the editor with an example, and test your regular expression against it.
Once you're satisfied with your regular expression, validate the operation by clicking on the Add button.
If you want to restrict the search of regular expressions to some specific file extensions, you can specify them on the right side of the regex edition:
Don't forget to click on the "+" button for each pattern you want to include.
If you've configured several regular expressions, both for positive and negative detection, you can define a priority order among them.
You can use the arrows on the left side to change the expression priorities. The algorithm will test each expression by order, and once one matches, it stops the execution. Thus, you won't get both positive and negative results since the first matching ends the search.
Users can customize the categories of practices for which they want to get suggestions in their IDE or during a code review. It's possible to exclude some categories of practices from the suggestions.
To configure this, click on Profile (your avatar) -> Administration -> Suggestions.
Then, you'll be able to input the categories of practices you want to exclude from the suggestions.
Here is an example if you wish to exclude suggestions from practices tagged with React. Click on Save to complete the operation.