ReviewBot Custom Tool

428 views
Skip to first unread message

vic...@hyperiondev.com

unread,
Sep 17, 2018, 11:09:48 AM9/17/18
to Review Board Development
Hi!

I am trying out Review Bot and I am really interested in developing a custom tool for some automated code analysis. On the Review Bot introduction page, it says that "Additional tools can be written and hooked into Review Bot through custom Python packages." I am quite new to Review Board and after looking at manuals and some of the source code of Review Bot and Review Board, I am still unable to figure out how to hook a custom tool into Review Bot. Could someone please share an insight on doing this?

Thanks in advance,
Victor

Joshua Cannon

unread,
Sep 17, 2018, 11:15:38 AM9/17/18
to Review Board Development
The ReviewBot worker uses pkg_installed to find any python packages installed that support the entrypoint their looking for. The entrypoint for new tools is "reviewbot.tools".

So the workflow would be to develop your tool and in setup.py make sure you register your entrypoint (you can see the registered entrypoints of the default tools underneath entry_points in the ReviewBot setup.py: https://github.com/reviewboard/ReviewBot/blob/master/bot/setup.py#L12). Then install your package (using pip or easy_install) and then when the worker runs, it will auto-magically detect your installed tool.

Victor

unread,
Sep 17, 2018, 11:24:32 AM9/17/18
to Review Board Development
Okay I see. Thank you so much for your help!

Christian Hammond

unread,
Sep 17, 2018, 4:53:33 PM9/17/18
to reviewb...@googlegroups.com
To be clear, you don't need to modify Review Bot itself for this. By creating a brand new Python package and making use of entry_points, Review Bot will pick it up once the package is installed (or running in "develop" mode). You will need to restart Review Bot, though.

We don't have documentation on writing tools today, but you can get a feel for how they're structured by reading through https://github.com/reviewboard/ReviewBot/tree/master/bot/reviewbot/tools. Each of these is a tool pointed to in entry_points.

Christian



--

---
You received this message because you are subscribed to the Google Groups "Review Board Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard-d...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Christian Hammond
President/CEO of Beanbag
Makers of Review Board

Victor

unread,
Sep 17, 2018, 5:09:51 PM9/17/18
to Review Board Development
Yeah I have seen the source code of the built-in tools, so I had a sense of what to do to construct the tool, but I was wondering about how do you actually 'hook' the tool onto Review Bot.
Thanks so much for your help! I am crystal clear about what needs to be done now.

Victor

Christian Hammond

unread,
Sep 17, 2018, 5:11:20 PM9/17/18
to reviewb...@googlegroups.com
Great! If you're able to later, I'd love to hear about your new tool :)

Christian
Reply all
Reply to author
Forward
0 new messages