Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some more rules to dangerfile #1560

Merged
merged 3 commits into from
Mar 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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