Skip to main content
Pro Plan Feature

This feature is available exclusively as part of the Pro plan and is not included in the Lite plan. Please refer to our pricing page for more information about our plans and features.

Docstrings

Docstrings generation is part of the finishing touches.

Usage

Once you are done with your pull request and its reviews, you may want to perform finishing touches to your code, such as adding in-code documentation. You can request CodeRabbit to generate docstrings by typing @coderabbitai generate docstrings in a comment under that pull request.

Once sent, CodeRabbit will perform the following actions:

  • All functions that are in the pull request's changes will be fetched using ast-grep
  • Docstrings will be generated for the functions where they are missing or incomplete
  • These docstrings will be committed in a new branch in the same repository
  • CodeRabbit will open a pull request from this new branch to the existing pull request

Here's an example of what a pull request may look like:

Docstrings PR

CodeRabbit cannot perform further modifications to opened pull requests. From there, it's your turn to checkout the branch and improve it to satisfaction. We believe that this workflow provides a significant headstart to documenting code.

This feature has been rigorously tested and is now available for all Pro plan users. Additionally, you can provide feedback about this feature on Discord.

Supported software forges

These software forges are supported:

  • Azure DevOps
  • Bitbucket Cloud
  • Bitbucket Data Center
  • GitHub
  • GitLab

While Bitbucket is not officially supported, docstrings can still be generated. However, they will be posted in a comment under the pull request. Full support for Bitbucket is planned.

Supported languages

These languages are supported:

  • Bash
  • C
  • C#
  • C++
  • Elixir
  • Go
  • Haskell
  • Java
  • JavaScript
  • Kotlin
  • Lua
  • Php
  • Python
  • React TypeScript
  • Ruby
  • Rust
  • Scala
  • Swift
  • TypeScript

CodeRabbit uses ast-grep to parse the code. If you want a new language to be supported, please look into Add New Language to ast-grep first.