Recipes and Code Lenses¶
Recipes are shortcuts to allow Sourcery to easily interact with a section of your code in powerful ways.
To start using a recipe, click on the code lens text above a function or class
Generate Tests), select the
Ask Sourcery code lens and choose a recipe
from the drop down, or select a section of code and click the recipe button in
Currently we have 5 Recipes available:
- Explain Code: Gives an explanation of what the code selection does and how it does it.
- Generate Tests: Creates a series of tests for the selected code
- Generate Docstrings: Creates a docstring for the function/class selected.
- Optimize Performance: Suggests improvements to the code to improve performance.
- Simplify Code: Suggests improvements to simplify the code and make it more readable.