artsy/peril-settings

Name: peril-settings

Owner: Artsy

Description: Artsy's peril settings

Created: 2016-09-12 17:43:30.0

Updated: 2018-05-22 13:49:11.0

Pushed: 2018-05-24 15:04:07.0

Homepage:

Size: 261

Language: TypeScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Artsy Peril Settings
What is this project?

This is the configuration repo for Peril on the Artsy org. There is a settings file and org-wide dangerfiles which are inside the org folder.

Here's some links to the key things

TLDR on this Repo?

Peril is Danger running on a web-server, this repo is the configuration for that, currently the dangerfiles in org run on every issue and pull request for all our repos.

To Develop
clone https://github.com/artsy/artsy-danger.git
rtsy-danger
 install
 .

You will need node and yarn installed beforehand. You can get them both by running brew install yarn. This will give you auto-completion and types for Danger/Peril mainly.

RFCs

It's likely that any time you want to make a change here you should consult the Artsy RFC process and apply it to this repo.

Implementing an RFC
Adding a rule

A rule should be wrapped in an rfc closure:

ttps://github.com/artsy/artsy-danger/issues/2
"Keep our Markdown documents awesome", () => {
 [...]

This self-documents where a rule has come from, making it easy for others to understand how we came to specific rules. The closure passed to rfc can be async as well.

Testing a rule

We use Jest to test our Dangerfiles. It uses the same techniques as testing a danger plugin where the global imports from danger are fake.

  1. Create a file for your RFC: tests/rfc_[x].test.ts.

  2. Add a before and after setting up and resetting mocks:

    .mock("danger", () => jest.fn())
    rt * as danger from "danger"
    t dm = danger as any
    
    reEach(() => {
    danger = {}
    fail = jest.fn() // as necessary
    
    
    rEach(() => {
    fail = undefined
    
    
  3. Set up your danger object and run the function exported in all-prs.ts:

    rt { rfcN } from "../org/all-prs"
    
    warns when there's there's no assignee and no WIP in the title", () => {
    danger.github = { pr: { title: "Changes to the setup script", assignee: null } }
    urn rfcN().then(() => {
    / [...]
    
    
    
  4. Validate that the fail/warn/message/markdown is called.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.