Skip to main content

Doc Rules created by AI

Swimm's Regex-based Rules is a feature that links your codebase to relevant documentation using regex rules.

Using AI to create rules

In the Rules tab in your IDE plugin, you have the option to create a rule from scratch or use AI assistance. Choose the option "Create a rule using AI (Beta)". This feature is particularly useful if you are not sure about the use case and you would like to get some ideas.

Choose the relevant document: This document will be linked with your regex rule and will be displayed whenever the rule's conditions are met in the code.

Discover use cases: Swimm AI will generate the top 3 use cases relevant to your document. Not happy with the results? Click the Regenerate button.

Select a use case: Once you've identified your use case, select it - Swimm AI will now suggest a few regex options that are relevant to your use case. Once the results are back, select a regex that looks the most relevant.

Customize the regex to your needs: The suggested regex might be exactly what you were looking for, but you can also tweak it to your needs.

  1. Save and test: Click Apply, and you will be able to see the highlighting in your code. We recommend testing in your IDE to see that the rule works the way you expect. Open a file and type to match the Regex pattern you defined. You should see the Rule match with the text you typed. If it doesn't, you may need to adjust the Regex pattern.

  2. Commit: Rules are stored in your code under the .swm/rules.json file. Commit and push your changes to this file. Once your colleagues pull the latest version which includes your changes, everyone will share the same rules.

Need help?

Head over to the /ask Swimm FAQ section or security page to learn more about our Azure OpenAI Integration.

This document is automatically kept up to date using Swimm.