Skip to content

Commit

Permalink
Add some more rules to dangerfile (#1560)
Browse files Browse the repository at this point in the history
* warn if the target branch is not master
* link to the logo guidance if PR modifies a SVG file in /logo/
  • Loading branch information
chris48s authored Mar 11, 2018
1 parent ae848f3 commit f8d511f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,27 @@ const helpers = fileMatch(
'!**/*.spec.js',
'!lib/all-badge-examples.js'
);
const logos = fileMatch(
'logo/*.svg'
);
const helperTests = fileMatch('lib/**/*.spec.js');
const packageJson = fileMatch('package.json');
const packageLock = fileMatch('package-lock.json');
const capitals = fileMatch('**/*[A-Z]*.js');
const underscores = fileMatch('**/*_*.js');
const targetBranch = danger.github.pr.base.ref;

message([
':sparkles: Thanks for your contribution to Shields, ',
`@${danger.github.pr.user.login}!`
].join(''));

if (targetBranch != 'master') {
const message = `This PR targets \`${targetBranch}\``;
const idea = 'It is likely that the target branch should be `master`';
warn(`${message} - <i>${idea}</i>`);
}

if (documentation.createdOrModified) {
message([
'Thanks for contributing to our documentation. ',
Expand Down Expand Up @@ -66,6 +76,15 @@ if (helpers.created && !helperTests.created) {
].join(''));
}

if (logos.created) {
message([
':art: Thanks for submitting a logo. ',
'Please ensure your contribution follows our ',
'[guidance](https://github.com/badges/shields/blob/master/CONTRIBUTING.md#logos) ',
'for logo submissions.'
].join(''));
}

if (capitals.created || underscores.created) {
fail([
'JavaScript source files should be named with kebab-case ',
Expand Down

0 comments on commit f8d511f

Please sign in to comment.