diff --git a/CHANGELOG.md b/CHANGELOG.md index ac3767f..94647e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [Unreleased](https://github.com/atomist/sdm-pack-seed/tree/HEAD) +## [Unreleased](https://github.com/atomist/sdm-pack-lifecycle/tree/HEAD) ### Added diff --git a/lib/handlers/event/pullrequest/rendering/PullRequestNodeRenderers.ts b/lib/handlers/event/pullrequest/rendering/PullRequestNodeRenderers.ts index 7fca23d..e17235b 100644 --- a/lib/handlers/event/pullrequest/rendering/PullRequestNodeRenderers.ts +++ b/lib/handlers/event/pullrequest/rendering/PullRequestNodeRenderers.ts @@ -217,7 +217,7 @@ export class StatusNodeRenderer extends AbstractIdentifiableContribution if (node.baseBranchName) { const pr = node as graphql.PullRequestToPullRequestLifecycle.PullRequest; return pr.state === "open" - && pr.commits != undefined && pr.commits.length > 0; + && !!pr.commits && pr.commits.length > 0; } else { return false; } @@ -228,9 +228,9 @@ export class StatusNodeRenderer extends AbstractIdentifiableContribution const repo = context.lifecycle.extract("repo"); const commits = pr.commits.sort((c1, c2) => (c2.timestamp || "").localeCompare(c1.timestamp || "")) - .filter(c => c.statuses != undefined && c.statuses.length > 0); + .filter(c => !!c.statuses && c.statuses.length > 0); - if (commits.length > 0 && commits[0].statuses != undefined) { + if (commits.length > 0 && !!commits[0].statuses) { const commit = commits[0]; const pending = commit.statuses.filter(s => s.state === "pending").length; @@ -313,7 +313,7 @@ export class ReviewNodeRenderer extends AbstractIdentifiableContribution const pending = reviews.length - changesRequested - success; let summary = this.summarizeReviewCounts(pending, success, changesRequested); - if (pr.reviewers != undefined && pr.reviewers.length > 0) { + if (!!pr.reviewers && pr.reviewers.length > 0) { summary += " \u00B7 " + pr.reviewers.map(r => r.login).join(" \u00B7 "); } @@ -404,7 +404,7 @@ export class BuildNodeRenderer extends AbstractIdentifiableContribution if (node.builds && node.commits) { const pr = node as graphql.PullRequestToPullRequestLifecycle.PullRequest; return pr.state === "open" - && pr.builds != undefined && pr.builds.length > 0; + && !!pr.builds && pr.builds.length > 0; } else { return false; } diff --git a/lib/handlers/event/push/rendering/StatusesNodeRenderer.ts b/lib/handlers/event/push/rendering/StatusesNodeRenderer.ts index b6e9d6f..f3a5a80 100644 --- a/lib/handlers/event/push/rendering/StatusesNodeRenderer.ts +++ b/lib/handlers/event/push/rendering/StatusesNodeRenderer.ts @@ -62,7 +62,7 @@ export class StatusesNodeRenderer extends AbstractIdentifiableContribution super("statuses"); } - public configure(configuration: LifecycleConfiguration) { + public configure(configuration: LifecycleConfiguration): void { this.showOnPush = configuration.configuration["show-statuses-on-push"] || true; this.emojiStyle = configuration.configuration["emoji-style"] || "default"; } @@ -94,7 +94,7 @@ export class StatusesNodeRenderer extends AbstractIdentifiableContribution // Now each one const lines = statuses.sort((s1, s2) => s1.context.localeCompare(s2.context)).map(s => { - if (s.targetUrl != undefined && s.targetUrl.length > 0) { + if (!!s.targetUrl && s.targetUrl.length > 0) { return `${this.emoji(s.state)} ${s.description} \u00B7 ${url(s.targetUrl, s.context)}`; } else { return `${this.emoji(s.state)} ${s.description} \u00B7 ${s.context}`; @@ -176,7 +176,7 @@ export class StatusesCardNodeRenderer extends AbstractIdentifiableContribution } let text; - if (s.targetUrl != undefined && s.targetUrl.length > 0) { + if (!!s.targetUrl && s.targetUrl.length > 0) { text = `${s.description} \u00B7 ${url(s.targetUrl, s.context)}`; } else { text = `${s.description} \u00B7 ${s.context}`; @@ -210,7 +210,7 @@ export class GoalSetNodeRenderer extends AbstractIdentifiableContribution super("goals"); } - public configure(configuration: LifecycleConfiguration) { + public configure(configuration: LifecycleConfiguration): void { this.emojiStyle = configuration.configuration["emoji-style"] || "default"; this.renderingStyle = configuration.configuration["rendering-style"] || SdmGoalDisplayFormat.full; } @@ -305,7 +305,7 @@ export class GoalSetNodeRenderer extends AbstractIdentifiableContribution details += ` \u00B7 approved by @${s.approval.userId}`; } } - if (s.url != undefined && s.url.length > 0) { + if (!!s.url && s.url.length > 0) { return `${this.emoji(s.state)} ${url(s.url, s.description)}${details}`; } else { return `${this.emoji(s.state)} ${s.description}${details}`; @@ -587,7 +587,7 @@ export class GoalCardNodeRenderer extends AbstractIdentifiableContribution const ts = lastGoals.map(g => g.ts); const gsid = lastGoals[0].goalSetId; const push = context.lifecycle.extract("push") as PushToPushLifecycle.Push; - const min = _.get((push.goalSets || []).find(gs => gs.goalSetId === gsid), "ts", 0); + const min = _.get((push.goalSets || []).find(gss => gss.goalSetId === gsid), "ts", 0); const max = _.max(ts); const dur = max - min;