Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

refactor(leaderboard): split recompute-all-skills.ts, 210 LOC over the 200 LOC limit

オープン 初心者向け
#27 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
backend

調査の方向性

まず apps/web/app/lib/leaderboard/recompute-all-skills.ts を読み、特に 31 行目の recomputeBatch と、139 行目付近から始まるスキルごとのループを確認します。スコアリング関数を重複させずに、ループを目的に特化した helper に抽出し、その後 wc -l を使って、バッチのオーケストレーションと戻り値の動作を維持したまま、各分割後のファイルが 200 行未満であることを確認します。

索引モデルが issue の本文から書いたものです。

説明

refactor

Summary

apps/web/app/lib/leaderboard/recompute-all-skills.ts is 210 lines, above the 200 LOC per-file limit in the project conventions. The bulk recompute path is the only leaderboard module over that limit.

Evidence

  • wc -l apps/web/app/lib/leaderboard/recompute-all-skills.ts → 210
  • CLAUDE.md, section "Important Caveats": "Max 200 LOC per file — split into focused modules if exceeded."
  • The code review measured 243 lines before the N+1 rework; the file is still over the limit after that change, so the rework reduced but did not resolve it.
  • Neighbouring modules for comparison: apps/web/app/routes/api.admin.recompute.ts is 131 lines and apps/web/app/lib/leaderboard/recompute-skill-scores.ts is a separate single-skill path.

Expected behavior

Split the module so each file stays under 200 lines. The per-skill compute-and-update loop (roughly lines 139-176, from for (const skill of batch) through the db.update(...) call) is the natural extraction, leaving recomputeBatch responsible for offset resolution, state persistence, and the return value.

Flow

flowchart LR
  A[recomputeBatch] --> B[resolve offset from KV]
  B --> C[global stats + batch fetch]
  C --> D[per-skill compute loop 210 LOC total]
  D --> E[persist KV state]

The loop labelled D is the extraction candidate; everything else is batch orchestration.

Evidence

  • Affected code: apps/web/app/lib/leaderboard/recompute-all-skills.ts:31 (recomputeBatch), apps/web/app/lib/leaderboard/recompute-all-skills.ts:139 (start of the per-skill loop)
  • Related: plans/reports/code-reviewer-260306-1531-admin-recompute-endpoint.md, section "5. recompute-all-skills.ts exceeds 200 LOC limit"

Open questions

  • Should the extracted helper move to a new recompute-skill-update.ts, or should the aggregate fetch block be the part that moves instead?

Notes

  • The extraction is mechanical and behavior-preserving. The scoring functions in leaderboard-scoring.ts are already shared with the single-skill path, so the split should not duplicate scoring logic.
主要言語
TypeScript
スター
189
フォーク
40
平均マージ
7時間 38分
マージ済み PR(30日)
30

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nextlevelbuilder/skillx のほかの issue

nextlevelbuilder/skillx の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。