Skip to content

Commit 77ab48f

Browse files
committed
Fix Sonarcube codesmells findings
1 parent be0b600 commit 77ab48f

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/commander.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)