New to Sensei? The following documents should help you get familiar with Sensei and the basics of recipe creation.
Installing Sensei will guide you through the different ways of installing Sensei, the recommended method is to use the install plugins functionality from within the IDE.
Overview has a basic overview of Where recipes are stored? What is a Search? What is a Quick Fix? And you will be introduced to the YAML format used to represent the recipe.
Writing a recipe, part 1 is a good place to start if you want to get hands on immediately. The tutorial will walk you through the steps to create a recipe and a Quick Fix to add a 'Logger' into your code. This is a simple example but it will get you used to creating and using a recipe.
Writing a recipe, part 2 is a hands on tutorial covering refactoring a recipe to make it more generic. It will help build muscle memory and get you more used to the GUI.
Sensei GUI Overview is an image based guide to help you learn the different dialogs and panels of the Sensei GUI.
Once you are familiar with the absolute basics you can read through the rest of the documentation to get a technical overview of the features.
We have some well documented use-cases in our Blog Examples project.
We have also collated all the public recipes and cookbooks that we know of in our Public Cookbooks repository. There are Cookbooks with Recipes for technologies like Spring, JUnit, Guice, Android and they cover both Security and Quality coding patterns.
What to try first?¶
The easiest way to make Sensei work for you is to look at your coding process and consider:
- What documentation do you keep looking up?
You could add some Sensei recipes that link back to that documentation.
- What simple mistakes do you keep making?
You could temporarily codify that poor coding pattern as a matcher, and write a Quick Fix rewrite that amends the code to be what you really want to write.
- What boilerplate code do you write to use a library?
You could create a Quick Fix action to write the code for you.
Since Sensei is designed to work alongside any static analysis tool you're using, if you find that the same violations are being reported from static analysis, then you could replicate the condition in a Sensei recipe. You can then add a Quick Fix to help train you, not just to identify the mistake but also to move quickly to writing the correct code.
The way to get most out of Sensei is by creating custom recipes and Quick Fixes that are unique to your process. The more you identify and codify patterns of programming behaviour you want to change, the faster you can start using Sensei to improve the quality of your code.