@shopify/danger
Danger is a static analysis tool used to automate code review by evaluating the content of a PR and reporting pass/fail status based on user-supplied rules for a repository. It is de-centralized and relies upon the APIs of a hosted git repository like GitHub.
This repo is a collection of open-source rules for DangerJS pipelines to enforce conventions such as warning if a PR is too large, if it lacks tests, etc.
Usage
Install:
yarn add @shopify/danger --dev
In your dangerfile:
// dangerfile.js
import analyze, {
skipForBots,
includeIssueNumber,
includeFrontendTesting,
includeBackendTesting,
warnIfLargePR,
} from "@shopify/danger";
// Skip testing for bots e.g. Dependabot
skipForBots(danger)
// Require an issue number
includeIssueNumber(danger)
// fail PRs with >2 FE or BE file changes without tests
includeFrontendTesting(danger, 2);
includeBackendTesting(danger, 2);
// Warn if a PR is larger than X amount of lines
warnIfLargePR(danger, 200)
Changelog
See the GitHub release history.
Contributing
See CONTRIBUTING.md.