npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hubot-code-review

v1.4.2

Published

A Hubot script for GitHub code review on Slack [archived]

Downloads

116

Readme

hubot-code-review

Travis branch npm version

A Hubot script for GitHub code review on Slack.

NO LONGER MAINTAINED

This project is no longer maintained. Alley is no longer using this project internally (we moved all code review workflows onto our other (free) Slack app Helperbot for a more integrated experience).

We are leaving it up for historical purposes. If you are interested in taking over maintenance, please reach out to us.

tldr;

Drop a GitHub pull request url into a room, and Hubot adds the pull request to the room's queue (each room has its own queue)...

Every 5 minutes, Hubot reports the current code review queue to the room (after an hour of no interaction, it messages @here with a warning and switches to hourly reminders)...

A co-worker can claim it for review...

Once the review is complete, a GitHub webhook listener catches approvals and Direct Messages the submitter:

Requirements

Installation via NPM

Run the following command to install this module as a Hubot dependency

npm install hubot-code-review --save

Confirm that hubot-code-review appears as a dependency in your Hubot package.json file.

"dependencies": {
  ...
  "hubot-code-review": "*",
  ...
}

To enable the script, add the hubot-code-review entry to the external-scripts.json file (you may need to create this file).

[
  ...
  "hubot-code-review",
  ...
]

Configuration

Code review queuing and notifications will work out of the box, but magic like file type lookups or DMs when your PR is approved/rejected require 2 things:

  1. Create a hubot-code-review webhook in GitHub so that Hubot can notice any changes
  1. Set Environmental variables:
  • If you set HUBOT_ENTERPRISE_GITHUB_URL to https://<your_enterprise_url>, Hubot will use it as your enterprise URL instead of the default: https://github.com

  • If HUBOT_GITHUB_TOKEN is set, Hubot can query the GitHub api for file type information on PR submission. Check out the instructions for configuring HUBOT_GITHUB_TOKEN for hubot-code-review

  • HUBOT_CODE_REVIEW_EMOJI_APPROVE an Alley Interactive cultural relic before the days GitHub incorporated pull request reviews. If this variable is true, a comment (excluding a comment.user.type of Bot) on the PR that includes one or more emoji conveys PR approval and will DM the submitter accordingly.

  • Set HUBOT_CODE_REVIEW_FILE_EXTENSIONS to a space separated list of file extensions (default "coffee css html js jsx md php rb scss sh txt yml") to configure what file types you prefer to group together in the HUBOT_CODE_REVIEW_META information alongside the PR slug in channel. Note that this requires a HUBOT_GITHUB_TOKEN for hubot-code-review

  • Set HUBOT_CODE_REVIEW_KARMA_DISABLED to true to prevent Hubot from listening for any code review karma commands.

  • Set HUBOT_CODE_REVIEW_KARMA_MONTHLY_AWARD_ROOM to automatically display a monthly resetting code review leaderboard to a particular room (for more info, check out the code review karma docs)

  • Set HUBOT_CODE_REVIEW_META to one of [ files, title, none, both (default files) ] to configure whether to display the pull request title, file types, or both alongside the PR slug in channel. Note that this requires a HUBOT_GITHUB_TOKEN for hubot-code-review

  • Set HUBOT_CODE_REVIEW_REMINDER_MINUTES to customize the number of minutes between pending code review prompts during the first hour of inactivity (the default is 5, and the effective max is 60). Note that hourly reminders will still take effect after the first 60 minutes.

  • Set HUBOT_CODE_REVIEW_HOUR_MESSAGE to customize the message that is displayed for the first-hour warning.

Usage

hubot help crs - See a help document explaining how to use.

{GitHub pull request URL} [@user]   Add PR to queue and (optionally) notify @user or #channel
[hubot ]on it                       Claim the oldest _new_ PR in the queue
[hubot ]userName is on it           Tell hubot that userName has claimed the oldest _new_ PR in the queue
on *                                Claim all _new_ PRs
[userName is ]on cool-repo/123      Claim cool-repo/123 if no one else has claimed it
[userName is ]on cool               Claim a _new_ PR whose slug matches cool
hubot (nm|ignore) cool-repo/123		Delete cool-repo/123 from queue regardless of status
hubot (nm|ignore) cool            	Delete most recently added PR whose slug matches cool
hubot (nm|ignore)                   Delete most recently added PR from the queue regardless of status
hubot redo cool-repo/123            Allow another review _without_ decrementing previous reviewer's score
hubot (unclaim|reset) cool-repo/123 Reset CR status to new/unclaimed _and_ decrement reviewer's score
hubot list crs                      List all _unclaimed_ CRs in the queue
hubot list [status] crs             List CRs with matching optional status

Note that some commands require direct @hubot, some don't, and some work either way.

Code review statuses

new		PR has just been added to the queue, no one is on it.
claimed		Someone is on this PR
approved	PR was approved. Requires GitHub webhook.
merged		PR was merged and closed. Requires GitHub webhook.
closed		PR was closed without merging. Requires GitHub webhook.