Skip to content

Commit e406616

Browse files
authored
Fix Sonarcube codesmells findings (#1620)
* Fix Sonarcube codesmells findings * what * Fix
1 parent be0b600 commit e406616

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/commander.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export class Commander {
223223

224224
const renderLine = (job: Job) => {
225225
const needs = job.needs?.filter(n => !n.project && !n.pipeline).map(n => n.job);
226-
const allowFailure = job.allowFailure ? "true " : "false";
226+
const allowFailure = job.allowFailure ? "true " : "false ";
227227
let jobLine = chalk`{blueBright ${job.name.padEnd(jobNamePad)}} ${job.description.padEnd(descriptionPadEnd)} `;
228228
jobLine += chalk`{yellow ${job.stage.padEnd(stagePadEnd)}} ${job.when.padEnd(whenPadEnd)} ${allowFailure.padEnd(11)}`;
229229
if (needs) {
@@ -268,7 +268,7 @@ export class Commander {
268268
writeStreams.stdout("name;description;stage;when;allowFailure;needs\n");
269269
jobs.forEach((job) => {
270270
const needs = job.needs?.filter(n => !n.project && !n.pipeline).map(n => n.job).join(",") ?? [];
271-
writeStreams.stdout(`${job.name};"${job.description}";${job.stage};${job.when};${job.allowFailure};[${needs}]\n`);
271+
writeStreams.stdout(`${job.name};"${job.description}";${job.stage};${job.when};${job.allowFailure ? "true" : "false"};[${needs}]\n`);
272272
});
273273
}
274274

src/parser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ export class Parser {
251251
let index = 0;
252252
if (expandVariables) {
253253
for (const line of fileSplit) {
254-
interactiveMatch = !interactiveMatch ? /#\s?@\s?[Ii]nteractive/.exec(line) : interactiveMatch;
255-
injectSSHAgent = !injectSSHAgent ? /#\s?@\s?[Ii]njectSSHAgent/.exec(line) : injectSSHAgent;
256-
noArtifactsToSourceMatch = !noArtifactsToSourceMatch ? /#\s?@\s?NoArtifactsToSource/i.exec(line) : noArtifactsToSourceMatch;
257-
descriptionMatch = !descriptionMatch ? /#\s?@\s?[Dd]escription (?<description>.*)/.exec(line) : descriptionMatch;
254+
interactiveMatch = interactiveMatch ?? /#\s?@\s?[Ii]nteractive/.exec(line);
255+
injectSSHAgent = injectSSHAgent ?? /#\s?@\s?[Ii]njectSSHAgent/.exec(line);
256+
noArtifactsToSourceMatch = noArtifactsToSourceMatch ?? /#\s?@\s?NoArtifactsToSource/i.exec(line);
257+
descriptionMatch = descriptionMatch ?? /#\s?@\s?[Dd]escription (?<description>.*)/.exec(line);
258258

259259
const jobMatch = /\w:/.exec(line);
260260
if (jobMatch && (interactiveMatch || descriptionMatch || injectSSHAgent || noArtifactsToSourceMatch)) {

0 commit comments

Comments
 (0)