Skip to content
Prev Previous commit
Next Next commit
Changed flag, removed unnecessary parens
  • Loading branch information
Tiriel committed Nov 8, 2017
commit 42113f16b781c2962373df5e6a8fa58bb495a194
9 changes: 5 additions & 4 deletions lib/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ function buildYargs(args = null) {
describe: 'File to write the metadata in',
type: 'string'
})
.option('comments', {
alias: 'c',
.option('check-comments', {
demandOption: false,
describe: 'Check for\'LGTM\' in comments',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above^

type: 'boolean'
Expand All @@ -53,8 +52,10 @@ const PR_RE = new RegExp(
'([0-9]+)(?:/(?:files)?)?$');

function checkAndParseArgs(args) {
const { owner = 'nodejs', repo = 'node', identifier, file, comments } = args;
const result = { owner, repo, file, comments };
const {
owner = 'nodejs', repo = 'node', identifier, file, checkComments
} = args;
const result = { owner, repo, file, checkComments };
if (!isNaN(identifier)) {
result.prid = +identifier;
} else {
Expand Down
4 changes: 2 additions & 2 deletions lib/pr_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class PRChecker {
let hint = this.getTSCHint(rejected);
logger.warn(`Rejections: ${rejected.length}${hint}`);
for (const { reviewer, review } of rejected) {
logger.warn(`${reviewer.getName()}) rejected in ${review.ref}`);
logger.warn(`${reviewer.getName()} rejected in ${review.ref}`);
}
}
if (approved.length === 0) {
Expand All @@ -103,7 +103,7 @@ class PRChecker {
if (review.source === FROM_COMMENT ||
review.source === FROM_REVIEW_COMMENT) {
logger.warn(
`${reviewer.getName()}) approved in via LGTM in comments`);
`${reviewer.getName()} approved in via LGTM in comments`);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion steps/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = async function getMetadata(argv, logger) {
}, 'Generated metadata:');

const checker = new PRChecker(logger, data);
const status = checker.checkAll(argv.comments);
const status = checker.checkAll(argv.checkComments);
return {
status,
request,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/args.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const parseArgs = require('../../lib/args');
const assert = require('assert');

const expected = {
comments: false,
checkComments: false,
owner: `nodejs`,
repo: `node`,
prid: 16637,
Expand Down
8 changes: 4 additions & 4 deletions test/unit/pr_checker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ describe('PRChecker', () => {

const expectedLogs = {
warn: [
['Quux User(Quux)) approved in via LGTM in comments'],
['Bar User(bar)) approved in via LGTM in comments'],
['Quux User(Quux) approved in via LGTM in comments'],
['Bar User(bar) approved in via LGTM in comments'],
['semver-major requires at least two TSC approvals']
],
info: [
Expand Down Expand Up @@ -112,8 +112,8 @@ describe('PRChecker', () => {
const expectedLogs = {
warn: [
['Rejections: 2, 1 from TSC (bar)'],
['Foo User(foo)) rejected in https://github.com/nodejs/node/pull/16438#pullrequestreview-71480624'],
['Bar User(bar)) rejected in https://github.com/nodejs/node/pull/16438#pullrequestreview-71482624'],
['Foo User(foo) rejected in https://github.com/nodejs/node/pull/16438#pullrequestreview-71480624'],
['Bar User(bar) rejected in https://github.com/nodejs/node/pull/16438#pullrequestreview-71482624'],
['Approvals: 0']
],
info: [],
Expand Down