Skip to content

Commit

Permalink
address comments and fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AshCripps authored and AshCripps committed May 29, 2020
1 parent 51080ea commit 62c31ed
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
3 changes: 1 addition & 2 deletions bin/ncu-ci
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
} = require('../lib/ci/ci_type_parser');

const {
PRBuild, BenchmarkRun, CommitBuild, HealthBuild, DailyBuild, Job,
PRBuild, BenchmarkRun, CommitBuild, HealthBuild, DailyBuild,
listBuilds, FailureAggregator, jobCache
} = require('../lib/ci/ci_result_parser');
const clipboardy = require('clipboardy');
Expand Down Expand Up @@ -367,7 +367,6 @@ class DailyCommand extends CICommand { //EDIT THIS
}

async initialize() {
//const ciType = commandToType[this.argv.type];
const ciType = DAILY_MASTER;
const builds = await listBuilds(this.cli, this.request, ciType);
this.queue.push({ type: 'health', ciType, builds });
Expand Down
49 changes: 24 additions & 25 deletions lib/ci/ci_result_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class TestBuild extends Job {
displayBuilds() {
const { cli, failures, builds } = this;
for (const failure of failures) {
if (failure != undefined){
if (failure !== undefined) {
this.displayFailure(failure);
}
}
Expand Down Expand Up @@ -329,7 +329,7 @@ class TestBuild extends Job {
const { failures } = this;
let output = `Failures in job ${this.jobUrl}\n\n`;
for (const failure of failures) {
if (failure != undefined){
if (failure !== undefined) {
output += `#### [${getNodeName(failure.url)}](${failure.url})`;
if (!failure.reason.includes('\n') && failure.reason.length < 20) {
const builtOn = failure.builtOn ? `On ${failure.builtOn}: ` : '';
Expand All @@ -354,26 +354,27 @@ class TestBuild extends Job {
}

function getHighlight(f) {
if (f.reason != undefined){
return f.reason.split('\n')[f.highlight]
.replace(/not ok \d+ /, '')
.replace(
/JNLP4-connect connection from \S+/, 'JNLP4-connect connection from ...'
)
.replace(/FATAL: Could not checkout \w+/, 'FATAL: Could not checkout ...')
.replace(
/error: pathspec .+ did not match any file\(s\) known to git/,
'error: pathspec ... did not match any file(s) known to git')
.replace(
/failed: no workspace for .+/,
'failed: no workspace for ...'
)
.replace(
/fatal: loose object \w+ \(stored in .git\/objects\/.+\) is corrupt/,
'fatal: loose object ... (stored in .git/objects/...) is corrupt')
.replace(/hudson\.plugins\.git\.GitException: /, '')
.replace(/java\.io\.IOException: /, '');
} else return f.reason = "failure not found";
if (!f.reason){
return f.reason = "failure not found";
}
return f.reason.split('\n')[f.highlight]
.replace(/not ok \d+ /, '')
.replace(
/JNLP4-connect connection from \S+/, 'JNLP4-connect connection from ...'
)
.replace(/FATAL: Could not checkout \w+/, 'FATAL: Could not checkout ...')
.replace(
/error: pathspec .+ did not match any file\(s\) known to git/,
'error: pathspec ... did not match any file(s) known to git')
.replace(
/failed: no workspace for .+/,
'failed: no workspace for ...'
)
.replace(
/fatal: loose object \w+ \(stored in .git\/objects\/.+\) is corrupt/,
'fatal: loose object ... (stored in .git/objects/...) is corrupt')
.replace(/hudson\.plugins\.git\.GitException: /, '')
.replace(/java\.io\.IOException: /, '');
}

function markdownRow(...args) {
Expand Down Expand Up @@ -910,15 +911,14 @@ class NormalBuild extends Job {
}

const { result, runs, builtOn } = data;
//console.log(data);
this.builtOn = builtOn;

if (result !== FAILURE) {
this.failures = [];
return this.failures;
}

if (runs != undefined){
if (!runs) return;

if (!runs.length) {
this.failures = [
Expand Down Expand Up @@ -954,7 +954,6 @@ class NormalBuild extends Job {
);
this.failures = flatten(failures);
return this.failures;
}
}
}

Expand Down

0 comments on commit 62c31ed

Please sign in to comment.