Aimlessly Going Forward

blog by Tomas Sedovic

Bookmarklet to expand inline comments in Gerrit

tech, tips

tl;dr: drag this link to your Bookmarks bar: Expand Gerrit Comments.

A core part of the OpenStack development culture is doing code reviews. To get a patch merged in an openstack project, it must be reviewed and approved by two core reviewers.

The reviews are coordinated through Gerrit where one can see the entire history of the proposed change, diffs, test results and the inline comments.

Unfortunately, when one reviews a file, the existing inline comments are collapsed by default and Gerrit offers no quick way to expand them all – you have to click on each one and the click targets aren’t particularly Fitts’-friendly.

If only there was a common way to script any browser!

So here’s a simple bookmarklet that that you can drag to your browser’s Bookmarks bar:

Expand Gerrit Comments

When you’re browsing a Gerrit page with inline comments (such as this one), just click on the Expand Gerrit Comments button and enjoy the flames!

The code behind this magick is quite straightforward:

Array.prototype.forEach.call(
    document.querySelectorAll(".commentPanelContent"),
    function(el, ix) {
        el.style.display = 'block';
    });

It should work in any modern browser. Licensed under WTFPL 2.0.

Happy bikeshedding.

Screenshot and link to the website for the Dose Response game

Hi! I wrote a game! It's an open-world roguelike where you play an addict called Dose Response. You can get it on the game's website (pay what you want!), it's cross-platform, works in the browser and it's open source! If you give it a go, let me know how you liked it, please!