Skip to content

Commit

Permalink
Delint
Browse files Browse the repository at this point in the history
  • Loading branch information
cdupuis committed May 17, 2019
1 parent 9115301 commit 8e28e04
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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 ");
}

Expand Down Expand Up @@ -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;
}
Expand Down
12 changes: 6 additions & 6 deletions lib/handlers/event/push/rendering/StatusesNodeRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down Expand Up @@ -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}`;
Expand Down Expand Up @@ -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}`;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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}`;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 8e28e04

Please sign in to comment.