-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 品質チェックコマンドのドキュメントを追加 #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2857b95
feat: 品質チェックコマンドのドキュメントを追加
github-actions[bot] 877e826
feat: add GitHub CLI configuration documentation
github-actions[bot] eae78ec
fix: 日本語コミットメッセージに対応するためsubject-caseルールを無効化
github-actions[bot] 6d5a4e3
docs: init-projectコマンドに日本語対応commitlint設定を追加
github-actions[bot] 4b45e32
docs: init-projectコマンドに品質管理設定を追加
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # check-coverage | ||
|
|
||
| ## 目的 | ||
|
|
||
| テストカバレッジが全リポジトリ70%以上、クリティカルパス100%の基準を満たしているか確認する。カバレッジの詳細レポートを生成し、改善点を特定。 | ||
|
|
||
| ## 実行手順 | ||
|
|
||
| 1. **カバレッジの測定** | ||
| ```bash | ||
| # カバレッジ付きでテストを実行 | ||
| npm run test -- --coverage | ||
| ``` | ||
|
|
||
| 2. **カバレッジサマリの確認** | ||
| ```bash | ||
| # コンソールでサマリを表示 | ||
| npm run coverage:summary | ||
| ``` | ||
|
|
||
| 3. **詳細レポートの生成** | ||
| ```bash | ||
| # HTMLレポートを生成 | ||
| npm run coverage:html | ||
|
|
||
| # レポートの場所を表示 | ||
| echo "Coverage report: ./coverage/lcov-report/index.html" | ||
| ``` | ||
|
|
||
| 4. **クリティカルパスの確認** | ||
| ```bash | ||
| # クリティカルパスのリストを確認 | ||
| echo "クリティカルパス:" | ||
| echo "- 認証/認可関連機能" | ||
| echo "- 決済処理" | ||
| echo "- セキュリティ関連機能" | ||
| echo "- データの保存/削除処理" | ||
| echo "- エラーハンドリング" | ||
| ``` | ||
|
|
||
| 5. **カバレッジが低いファイルの特定** | ||
| ```bash | ||
| # カバレッジが50%未満のファイルをリスト | ||
| npm run coverage:low-files | ||
| ``` | ||
|
|
||
| 6. **カバレッジレポートのCI用出力** | ||
| ```bash | ||
| # CI用のJUnit形式で出力 | ||
| npm run coverage:ci | ||
| ``` | ||
|
|
||
| 7. **カバレッジ履歴の確認** | ||
| ```bash | ||
| # 過去のカバレッジと比較 | ||
| git show HEAD~1:coverage/coverage-summary.json 2>/dev/null || echo "履歴なし" | ||
| ``` | ||
|
|
||
| ## 成功基準 | ||
|
|
||
| - ✅ 全体のラインカバレッジが70%以上 | ||
| - ✅ ブランチカバレッジが60%以上 | ||
| - ✅ 関数カバレッジが65%以上 | ||
| - ✅ クリティカルパスのカバレッジが100% | ||
| - ✅ カバレッジレポートが正常に生成される | ||
|
|
||
| ## トラブルシューティング | ||
|
|
||
| ### カバレッジが基準を満たさない場合 | ||
| 1. HTMLレポートで未カバーのコードを確認 | ||
| 2. 優先度順にテストを追加: | ||
| - クリティカルパス > ビジネスロジック > ユーティリティ | ||
| 3. テストが難しいコードはリファクタリングを検討 | ||
|
|
||
| ### カバレッジが測定されない場合 | ||
| 1. `jest.config.js` またはテスト設定を確認 | ||
| 2. `collectCoverageFrom` の設定を確認 | ||
| 3. テストが実行されているか確認 | ||
|
|
||
| ### クリティカルパスの特定が難しい場合 | ||
| 1. ビジネス要件を確認 | ||
| 2. セキュリティチームと連携 | ||
| 3. リスクアセスメントを実施 | ||
| 4. `.critical-paths.json` ファイルで明示的に定義 | ||
|
|
||
| ### カバレッジの向上方法 | ||
| 1. TDDを徹底(テストファースト) | ||
| 2. モックを活用して依存関係を分離 | ||
| 3. エッジケースのテストを追加 | ||
| 4. カバレッジ目標を段階的に設定(60% → 70% → 80%) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| # fix-ci | ||
|
|
||
| ## 目的 | ||
|
|
||
| CI失敗時の対応手順を提供し、24時間以内修正ルールを遵守する。CI Red → Slack #ci-alerts → 24h以内修正 or Owner Escalateのフローを実行。 | ||
|
|
||
| ## 実行手順 | ||
|
|
||
| 1. **CIエラーの特定** | ||
| ```bash | ||
| # GitHub Actionsのログを確認 | ||
| gh run list --limit 5 | ||
| gh run view <run-id> | ||
|
|
||
| # 失敗したジョブの詳細を確認 | ||
| gh run view <run-id> --log-failed | ||
| ``` | ||
|
|
||
| 2. **エラータイプの分類** | ||
| ```bash | ||
| echo "エラータイプを確認:" | ||
| echo "1. テスト失敗" | ||
| echo "2. Lintエラー" | ||
| echo "3. ビルドエラー" | ||
| echo "4. セキュリティ/脆弱性" | ||
| echo "5. デプロイ失敗" | ||
| ``` | ||
|
|
||
| 3. **ローカルでの再現** | ||
| ```bash | ||
| # CI環境と同じコマンドを実行 | ||
| npm ci | ||
| npm run test:all | ||
| npm run quality:check | ||
| npm run build | ||
| ``` | ||
|
|
||
| 4. **修正の実施** | ||
|
|
||
| ### テスト失敗の場合 | ||
| ```bash | ||
| # 失敗したテストを特定 | ||
| npm run test -- --verbose | ||
| # 修正後、再度テスト | ||
| npm run test -- --watch | ||
| ``` | ||
|
|
||
| ### Lintエラーの場合 | ||
| ```bash | ||
| # 自動修正を試す | ||
| npm run lint -- --fix | ||
| npm run format:fix | ||
| ``` | ||
|
|
||
| ### ビルドエラーの場合 | ||
| ```bash | ||
| # キャッシュをクリア | ||
| rm -rf node_modules package-lock.json | ||
| npm install | ||
| npm run build | ||
| ``` | ||
|
|
||
| ### セキュリティ問題の場合 | ||
| ```bash | ||
| # 脆弱性を修正 | ||
| npm audit fix | ||
| # 強制的に修正(注意が必要) | ||
| npm audit fix --force | ||
| ``` | ||
|
|
||
| 5. **修正の確認とプッシュ** | ||
| ```bash | ||
| # ローカルでCIと同じチェックを実行 | ||
| npm run ci:check | ||
|
|
||
| # 修正をコミット | ||
| git add . | ||
| git commit -m "fix: CIエラーを修正 (#<issue-number>)" | ||
|
|
||
| # プッシュ | ||
| git push | ||
| ``` | ||
|
|
||
| 6. **CIの再実行を確認** | ||
| ```bash | ||
| # CIがグリーンになるまでモニタリング | ||
| gh run watch | ||
| ``` | ||
|
|
||
| 7. **対応完了の報告** | ||
| ```bash | ||
| # Slack #ci-alertsへの報告テンプレート | ||
| echo "CI修正完了報告:" | ||
| echo "- エラー: <エラー内容>" | ||
| echo "- 原因: <原因>" | ||
| echo "- 対応: <対応内容>" | ||
| echo "- PR: #<PR番号>" | ||
| ``` | ||
|
|
||
| ## 成功基準 | ||
|
|
||
| - ✅ CIがグリーンになる | ||
| - ✅ 24時間以内に修正完了 | ||
| - ✅ Slack #ci-alertsに報告済み | ||
| - ✅ 根本原因が特定され、再発防止策が実施される | ||
|
|
||
| ## トラブルシューティング | ||
|
|
||
| ### 24時間以内に修正できない場合 | ||
| 1. Ownerにエスカレーション | ||
| 2. 一時的なワークアラウンドを検討 | ||
| 3. RevertしてCIをグリーンにし、後日修正 | ||
|
|
||
| ### ローカルで再現しない場合 | ||
| 1. CI環境との差分を確認(Nodeバージョン、環境変数等) | ||
| 2. DockerでCI環境を再現 | ||
| 3. CIのキャッシュをクリア | ||
|
|
||
| ### 繰り返しCIが失敗する場合 | ||
| 1. Flakyテストの可能性を確認 | ||
| 2. テストの安定性を改善(タイムアウト設定、非同期処理の改善) | ||
| 3. CIパイプラインのリトライ設定を追加 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Package-manager inconsistency (pnpm vs npm)
Earlier docs recommend pnpm; this section uses
npm ci. Mixing tools can create divergent lockfiles and caches. Standardise on one (or note both variants).🤖 Prompt for AI Agents