feat: setup Danger #1289
4 changed files with 17 additions and 26 deletions
|
@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|||
* Show exact wallet balance on mouse hover over ([#1305](https://github.com/lbryio/lbry-app/pull/1305))
|
||||
* New dark mode ([#1269](https://github.com/lbryio/lbry-app/pull/1269))
|
||||
* Pre-fill publish URL after clicking "Put something here" link ([#1303](https://github.com/lbryio/lbry-app/pull/1303))
|
||||
* Add Danger JS to automate code reviews ([#1289](https://github.com/lbryio/lbry-app/pull/1289))
|
||||
|
||||
### Changed
|
||||
* Add flair to snackbar ([#1313](https://github.com/lbryio/lbry-app/pull/1313))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import { danger, warn } from 'danger';
|
||||
import eslint from 'danger-plugin-eslint';
|
||||
|
||||
// No PR is too small to include a description of why you made a change
|
||||
if (!danger.github.pr.body || danger.github.pr.body.length < 10) {
|
||||
|
@ -9,25 +8,6 @@ if (!danger.github.pr.body || danger.github.pr.body.length < 10) {
|
|||
warn(`${title} - <i>${idea}</i>`);
|
||||
}
|
||||
|
||||
// Tags big PRs
|
||||
const bigPRThreshold = 600;
|
||||
if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) {
|
||||
const title = ':exclamation: Big PR';
|
||||
const idea = `This PR is extremely unlikely to get reviewed because it touches ${danger.github.pr
|
||||
.additions + danger.github.pr.deletions} lines.`;
|
||||
warn(`${title} - <i>${idea}</i>`);
|
||||
} else if (
|
||||
danger.git.modified_files + danger.git.added_files + danger.git.deleted_files >
|
||||
bigPRThreshold
|
||||
) {
|
||||
const title = ':exclamation: Big PR';
|
||||
const idea = `This PR is extremely unlikely to get reviewed because it touches ${danger.git
|
||||
.modified_files +
|
||||
danger.git.added_files +
|
||||
danger.git.deleted_files} files.`;
|
||||
warn(`${title} - <i>${idea}</i>`);
|
||||
}
|
||||
|
||||
// Check for a CHANGELOG entry
|
||||
const hasChangelog = danger.git.modified_files.some(f => f === 'CHANGELOG.md');
|
||||
if (!hasChangelog) {
|
||||
|
@ -35,6 +15,3 @@ if (!hasChangelog) {
|
|||
const idea = 'Please add a changelog entry for your changes.';
|
||||
warn(`${title} - <i>${idea}</i>`);
|
||||
}
|
||||
|
||||
// Check for ESLint problems
|
||||
eslint();
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
"babel-preset-stage-2": "^6.18.0",
|
||||
"danger": "^3.6.0",
|
||||
"danger-plugin-eslint": "^0.1.0",
|
||||
"danger-plugin-yarn": "^1.3.0",
|
||||
"decompress": "^4.2.0",
|
||||
"del": "^3.0.0",
|
||||
"devtron": "^1.4.0",
|
||||
|
|
18
yarn.lock
18
yarn.lock
|
@ -2514,6 +2514,18 @@ danger-plugin-eslint@^0.1.0:
|
|||
optionalDependencies:
|
||||
esdoc "^0.5.2"
|
||||
|
||||
danger-plugin-yarn@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/danger-plugin-yarn/-/danger-plugin-yarn-1.3.0.tgz#59b707c866bf40c0b1e2b2b945a8287c75366453"
|
||||
dependencies:
|
||||
date-fns "^1.28.5"
|
||||
lodash.flatten "^4.4.0"
|
||||
lodash.includes "^4.3.0"
|
||||
node-fetch "^1.7.1"
|
||||
semver "^5.4.1"
|
||||
optionalDependencies:
|
||||
esdoc "^0.5.2"
|
||||
|
||||
danger@^3.6.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.yarnpkg.com/danger/-/danger-3.6.0.tgz#14ee47cf26edf43fda8e2fc3cb9c9441feba079c"
|
||||
|
@ -2560,7 +2572,7 @@ data-urls@^1.0.0:
|
|||
whatwg-mimetype "^2.0.0"
|
||||
whatwg-url "^6.4.0"
|
||||
|
||||
date-fns@^1.27.2:
|
||||
date-fns@^1.27.2, date-fns@^1.28.5:
|
||||
version "1.29.0"
|
||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6"
|
||||
|
||||
|
@ -6025,7 +6037,7 @@ lodash.find@^4.6.0:
|
|||
version "4.6.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1"
|
||||
|
||||
lodash.flatten@^4.2.0:
|
||||
lodash.flatten@^4.2.0, lodash.flatten@^4.4.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f"
|
||||
|
||||
|
@ -6589,7 +6601,7 @@ node-cleanup@^2.1.2:
|
|||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/node-cleanup/-/node-cleanup-2.1.2.tgz#7ac19abd297e09a7f72a71545d951b517e4dde2c"
|
||||
|
||||
node-fetch@^1.0.1:
|
||||
node-fetch@^1.0.1, node-fetch@^1.7.1:
|
||||
version "1.7.3"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef"
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in a new issue