Skip to content

Commit

Permalink
Merge pull request #16 from nomoixyz/add-number-to-issue
Browse files Browse the repository at this point in the history
feat: add number to issue title
  • Loading branch information
gnkz authored Jan 11, 2023
2 parents dae81b8 + ee3be9c commit b09f7f1
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,40 +75,36 @@ export class Formatter {
result.push(`<h2 align="center">Findings</h2>`);
}

let counter = 1;

for (const issue of criticalFindings) {
result.push(`### ${issue.title}`);
result.push(this.issueBadges(issue));
result.push(issue.body.replace(/\r/gm, ""));
result.push(this.formatIssue(counter, issue));
counter++;
}

for (const issue of highFindings) {
result.push(`### ${issue.title}`);
result.push(this.issueBadges(issue));
result.push(issue.body.replace(/\r/gm, ""));
result.push(this.formatIssue(counter, issue));
counter++;
}

for (const issue of mediumFindings) {
result.push(`### ${issue.title}`);
result.push(this.issueBadges(issue));
result.push(issue.body.replace(/\r/gm, ""));
result.push(this.formatIssue(counter, issue));
counter++;
}

for (const issue of lowFindings) {
result.push(`### ${issue.title}`);
result.push(this.issueBadges(issue));
result.push(issue.body.replace(/\r/gm, ""));
result.push(this.formatIssue(counter, issue));
counter++;
}

for (const issue of enhancements) {
result.push(`### ${issue.title}`);
result.push(this.issueBadges(issue));
result.push(issue.body.replace(/\r/gm, ""));
result.push(this.formatIssue(counter, issue));
counter++;
}

for (const issue of optimizations) {
result.push(`### ${issue.title}`);
result.push(this.issueBadges(issue));
result.push(issue.body.replace(/\r/gm, ""));
result.push(this.formatIssue(counter, issue));
counter++;
}

const conclusion = issues.find(i => i.type === Type.CONCLUSION);
Expand All @@ -120,6 +116,14 @@ export class Formatter {
return result.join(`\n\n`);
}

private formatIssue(index: number, issue: ParsedIssue): string {
return [
`### ${index}. ${issue.title}`,
this.issueBadges(issue),
issue.body.replace(/\r/gm, ""),
].join(`\n\n`);
}

private formatDate(date: Date): string {
return date.toLocaleString("en-US", {
weekday: "long",
Expand Down

0 comments on commit b09f7f1

Please sign in to comment.