Skip to content

Commit

Permalink
refactor: rule commit-name
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Nov 10, 2017
1 parent f7c721d commit 082855d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/rules/commit-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ module.exports = {
};

function users(cmt) {
const author = user(cmt, 'author');
const committer = user(cmt, 'committer');
if (author == committer) return author;
if (author && committer) return `${author} and ${committer}`;
return author || committer;
const a = user(cmt, 'author');
const c = user(cmt, 'committer');
if (a && c && a != c) return `${a} and ${c}`;
return a || c;
}

function user(cmt, userType) {
return cmt[userType] && cmt[userType].login && ('@' + cmt[userType].login) || cmt.commit[userType].name;
return cmt[userType] && cmt[userType].login
? '@' + cmt[userType].login
: cmt.commit[userType].name;
}

function uniques(arr) {
Expand Down

0 comments on commit 082855d

Please sign in to comment.