镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(sonar): give the edge reduce an initial accumulator (javascript:S6959) - #32

Merged
setchy merged 1 commit into
mainfrom
sonar/S6959-reduce-initial
Nov 4, 2026
Merged

setchy merged 1 commit into
mainfrom
sonar/S6959-reduce-initial

Conversation

@setchy

@setchy setchy commented Nov 4, 2026

Copy link
Copy Markdown
Member

Summary

Sonar rule javascript:S6959 flags Array#reduce() calls without an initial value. pointerAnchor reduced the four display-edge distances with no initial accumulator, so the call would throw on an empty edge list and the accumulator's starting value was implicit.

Changes

  • gitify/contents/code/main.js: capture the edge keys once and pass the first key as the initial accumulator, so the reduction always has a defined seed.

Verification

  • pnpm lint:check — passed
  • pnpm test — 28 passed, 0 failed

Sonar issues

https://sonarcloud.io/project/issues?id=gitify-app_kde&s=IMPACT_RANK&issueStatuses=OPEN&rules=javascript%3AS6959

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@setchy
setchy marked this pull request as ready for review November 4, 2026 17:26
@setchy
setchy requested a review from afonsojramos as a code owner November 4, 2026 17:26
@setchy
setchy merged commit 45b359f into main Nov 4, 2026
2 checks passed
@setchy
setchy deleted the sonar/S6959-reduce-initial branch November 4, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant