Skip to content

Commit

Permalink
chore(danger): update dangerfile to validate commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Feb 9, 2017
1 parent 6ce4773 commit e3b3f61
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var fs = require('fs');
var path = require('path');
var _ = require('lodash');
var validateMessage = require('validate-commit-msg');

//simple regex matcher to detect usage of helper function and its type signature
var hotMatch = /\bhot\(/gi;
Expand Down Expand Up @@ -53,4 +54,18 @@ var testFilesMissingTypes = modifiedSpecFiles.reduce(function (acc, value) {
if (testFilesMissingTypes.length > 0) {
fail('missing type definition import in tests (' + testFilesMissingTypes + ') (' + ++errorCount + ')');
markdown('> (' + errorCount + ') : It seems updated test cases uses test scheduler interface `hot`, `cold` but miss to import type signature for those.');
}

var commits = danger.git.commits;
console.log(commits);
var messageConventionValid = commits.reduce(function (acc, value) {
var valid = validateMessage(value.message);
console.log(value.message);
console.log(valid);
return valid && acc;
}, true);

if (!messageConventionValid) {
fail('commit message does not follows conventional change log (' + ++errorCount + ')');
markdown('> (' + errorCount + ') : RxJS uses conventional change log to generate changelog automatically. It seems some of commit messages are not following those, please check [contributing guideline](https://github.com/ReactiveX/rxjs/blob/master/CONTRIBUTING.md#commit-message-format) and update commit messages.');
}

0 comments on commit e3b3f61

Please sign in to comment.