Skip to content

Commit

Permalink
Address code smells reported by sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
alchemicas committed Dec 25, 2023
1 parent 54d3712 commit d8366e5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class List extends Child {
.every(
(li: cheerio.Element) =>
this.main.cheerio(li).has('a') &&
this.main.cheerio('a', li).text().match(this.regex) &&
this.regex.exec(this.main.cheerio('a', li).text()) &&
!this.main.cheerio(li).html()?.includes('<em>') &&
!this.main
.cheerio(li)
Expand Down
2 changes: 1 addition & 1 deletion src/components/paragraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class Paragraph extends Child {
.toArray()
.filter(
(p: cheerio.Element) =>
this.main.cheerio(p).html()?.includes('Currently holds no information.') && this.main.cheerio(p).prev('h4').text().match(this.regex)
this.main.cheerio(p).html()?.includes('Currently holds no information.') && this.regex.exec(this.main.cheerio(p).prev('h4').text())
)
}
}
4 changes: 2 additions & 2 deletions src/components/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export class Writer extends Child {
case type.includes('Array of'):
let arrayOfs: number, ands: number

arrayOfs = (type.match(/Array of/g) || []).length
ands = (type.match(/( and |,)/g) || []).length
arrayOfs = (type.match(/Array of/g) ?? []).length
ands = (type.match(/( and |,)/g) ?? []).length

return (
(ands > 0 ? '(' : '') +
Expand Down

0 comments on commit d8366e5

Please sign in to comment.