-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add shellcheck static analysis for shell scripts #190
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
3 commits
Select commit
Hold shift + click to select a range
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
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
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,312 @@ | ||
| # 技術的負債リメディエーション計画 | ||
|
|
||
| ## 概要 | ||
|
|
||
| このディレクトリには、技術的負債の分析結果と各問題に対する詳細な解決計画が含まれています。 | ||
|
|
||
| **作成日**: 2025-12-30 | ||
| **負債スコア**: 520/1000 (中程度) | ||
| **総投資見積**: 193時間 ($28,950) | ||
| **期待ROI**: 12ヶ月で73-127% | ||
|
|
||
| ## 優先順位付けされたIssueリスト | ||
|
|
||
| ### 🔴 クリティカル | ||
|
|
||
| | Issue | タイトル | 工数 | ROI | 期限 | | ||
| | -------------------------------------- | -------------------------- | ------ | ------ | --------- | | ||
| | [#001](tech-debt-001-test-coverage.md) | テストカバレッジ不足の解消 | 96時間 | 75-88% | Month 1-2 | | ||
|
|
||
| ### 🟠 高優先度(Quick Wins) | ||
|
|
||
| | Issue | タイトル | 工数 | ROI | 期限 | | ||
| | ------------------------------------------------ | -------------------------------- | -------- | ---- | ------- | | ||
| | [#002](tech-debt-002-shellcheck.md) | shellcheck静的解析の導入 | 5.75時間 | 234% | Week 1 | | ||
| | [#004](tech-debt-004-shell-integration-tests.md) | シェルスクリプトの統合テスト実装 | 28時間 | 243% | Month 1 | | ||
|
|
||
| ### 🟡 中優先度 | ||
|
|
||
| | Issue | タイトル | 工数 | ROI | 期限 | | ||
| | ------------------------------------------ | ---------------------------------- | ------- | -------- | --------- | | ||
| | [#003](tech-debt-003-nodejs-version.md) | Node.jsバージョンの統一 | 6.5時間 | 136-187% | Week 2 | | ||
| | [#005](tech-debt-005-shell-refactoring.md) | シェルスクリプトのリファクタリング | 34時間 | 76% | Month 2-3 | | ||
|
|
||
| ### 🟢 低~中優先度 | ||
|
|
||
| | Issue | タイトル | 工数 | ROI | 期限 | | ||
| | -------------------------------------- | -------------------------- | ------ | --- | --------- | | ||
| | [#006](tech-debt-006-documentation.md) | ドキュメンテーションの改善 | 44時間 | 45% | Quarter 2 | | ||
|
|
||
| ## 実装ロードマップ | ||
|
|
||
| ### Week 1-2: Quick Wins(即効性のある改善) | ||
|
|
||
| **目標**: 低コストで高いリターンを得る | ||
|
|
||
| ``` | ||
| Day 1-2: shellcheck導入 (#002) | ||
| - DevContainerに追加 | ||
| - CIパイプラインに統合 | ||
| - 既存違反の修正 | ||
|
|
||
| Day 3-5: Node.jsバージョン統一 (#003) | ||
| - DevContainerをv22に更新 | ||
| - テストと検証 | ||
| - ドキュメント更新 | ||
|
|
||
| Day 6-10: 基本統合テストのセットアップ (#004) | ||
| - Batsフレームワークのインストール | ||
| - テストヘルパーの作成 | ||
| - 最初のテストスイート作成 | ||
| ``` | ||
|
|
||
| **期待成果**: | ||
|
|
||
| - shellcheck違反0件 | ||
| - すべての環境でNode.js v22 | ||
| - 基本的な統合テストが動作 | ||
|
|
||
| ### Month 1-2: テスト実装(信頼性の向上) | ||
|
|
||
| **目標**: テストカバレッジ70%達成 | ||
|
|
||
| ``` | ||
| Week 1-2: JavaScriptコードのユニットテスト (#001) | ||
| - commitlint.config.js のテスト | ||
| - jest.config.js のテスト | ||
|
|
||
| Week 3-4: シェルスクリプトの統合テスト (#004) | ||
| - platform.sh のテスト | ||
| - import.sh のテスト | ||
| - export.sh のテスト | ||
|
|
||
| Week 5-8: カバレッジ目標達成 (#001) | ||
| - 追加テストケース作成 | ||
| - E2Eテスト実装 | ||
| - Codecov統合 | ||
| ``` | ||
|
|
||
| **期待成果**: | ||
|
|
||
| - テストカバレッジ ≥ 70% | ||
| - CI/CDで自動テスト実行 | ||
| - カバレッジレポートの可視化 | ||
|
|
||
| ### Month 2-3: リファクタリング(保守性の向上) | ||
|
|
||
| **目標**: コードの品質と保守性を改善 | ||
|
|
||
| ``` | ||
| Week 1: 共通ライブラリ関数の作成 (#005) | ||
| - script/lib/config.sh | ||
| - script/lib/errors.sh | ||
|
|
||
| Week 2: import.shリファクタリング (#005) | ||
| - 重複コード削除 | ||
| - 共通関数の使用 | ||
|
|
||
| Week 3: export.shリファクタリング (#005) | ||
| - 重複コード削除 | ||
| - エラーハンドリング強化 | ||
|
|
||
| Week 4: テストの更新とドキュメント (#005, #006) | ||
| - リファクタリング後のテスト修正 | ||
| - 関数ドキュメント追加 | ||
| ``` | ||
|
|
||
| **期待成果**: | ||
|
|
||
| - 重複コード50行以上削減 | ||
| - エラーハンドリングの一貫性 | ||
| - 関数レベルのドキュメント完備 | ||
|
|
||
| ### Quarter 2-4: 長期改善(持続可能性の確保) | ||
|
|
||
| **目標**: 継続的な品質維持の仕組み構築 | ||
|
|
||
| ``` | ||
| Month 4-5: ADRとトラブルシューティング (#006) | ||
| - アーキテクチャ決定記録の作成 | ||
| - トラブルシューティングガイド | ||
|
|
||
| Month 6: 継続的品質監視 | ||
| - メトリクスダッシュボード | ||
| - 自動品質ゲート | ||
| - 週次レポート | ||
| ``` | ||
|
|
||
| **期待成果**: | ||
|
|
||
| - 意思決定の透明性向上 | ||
| - 問題解決時間の短縮 | ||
| - 継続的な品質改善 | ||
|
|
||
| ## 現在の状況 | ||
|
|
||
| ### ✅ 強み | ||
|
|
||
| - 包括的なREADMEとセキュリティドキュメント | ||
| - 自動化されたCI/CDパイプライン | ||
| - Conventional Commits採用 | ||
| - semantic-releaseによる自動バージョニング | ||
|
|
||
| ### ❌ 課題 | ||
|
|
||
| - テストカバレッジ0% → 目標70% | ||
| - シェルスクリプトの静的解析なし | ||
| - Node.jsバージョン不一致 | ||
| - 重複コードの存在 | ||
|
|
||
| ## 成功メトリクス | ||
|
|
||
| ### 月次KPI | ||
|
|
||
| ```yaml | ||
| テストカバレッジ: | ||
| 現在: 0% | ||
| 3ヶ月目標: 50% | ||
| 6ヶ月目標: 70% | ||
| 12ヶ月目標: 80% | ||
|
|
||
| シェルスクリプト品質: | ||
| shellcheck違反: 0件 (warning以上) | ||
| batsテストカバレッジ: 60% | ||
|
|
||
| デプロイ信頼性: | ||
| CI失敗率: <2% | ||
| 本番バグ: <0.5件/月 | ||
|
|
||
| 開発速度: | ||
| リードタイム: -30%改善 | ||
| デプロイ頻度: 週5回以上 | ||
| ``` | ||
|
|
||
| ### 四半期レビュー | ||
|
|
||
| ```yaml | ||
| Q1 (Month 1-3): | ||
| - shellcheck導入完了 ✓ | ||
| - Node.jsバージョン統一 ✓ | ||
| - 基本的な統合テスト実装 ✓ | ||
| - カバレッジ50%達成 | ||
|
|
||
| Q2 (Month 4-6): | ||
| - ユニットテスト完全実装 | ||
| - シェルスクリプトリファクタリング | ||
| - カバレッジ70%達成 | ||
| - ADR導入 | ||
|
|
||
| Q3 (Month 7-9): | ||
| - 継続的監視ダッシュボード | ||
| - 高度な統合テスト | ||
| - カバレッジ80%達成 | ||
|
|
||
| Q4 (Month 10-12): | ||
| - パフォーマンスベンチマーク | ||
| - セキュリティ監査 | ||
| - 最終目標達成の評価 | ||
| ``` | ||
|
|
||
| ## コスト・ベネフィット分析 | ||
|
|
||
| ### 総投資 | ||
|
|
||
| ``` | ||
| Quick Wins (Week 1-2): 27時間 = $4,050 | ||
| 中期改善 (Month 1-3): 120時間 = $18,000 | ||
| 長期 (Quarter 2-4): 46時間 = $6,900 | ||
| ----------------------------------------------- | ||
| 合計: 193時間 = $28,950 | ||
| ``` | ||
|
|
||
| ### 期待リターン | ||
|
|
||
| ``` | ||
| 年間コスト削減: | ||
| テストカバレッジ改善: $10,800-12,600 | ||
| シェルスクリプト品質: $2,400-3,360 | ||
| Node.jsバージョン統一: $500-1,000 | ||
| その他の効率化: $3,000-5,000 | ||
| ----------------------------------------------- | ||
| 年間総節約: $16,700-21,960 | ||
|
|
||
| ROI: | ||
| 1年目: -42% ~ -24% (投資期間) | ||
| 2年目: 15% ~ 52% (累積) | ||
| 3年目: 73% ~ 127% (累積) | ||
| ``` | ||
|
|
||
| ## 次のステップ | ||
|
|
||
| ### 今週実行 | ||
|
|
||
| 1. **Issue #002: shellcheck導入** (2時間) | ||
|
|
||
| ```bash | ||
| # DevContainerに追加 | ||
| echo 'RUN apt-get install -y shellcheck' >> .devcontainer/Dockerfile | ||
|
|
||
| # npm scriptに追加 | ||
| npm pkg set scripts.shellcheck="find script -name '*.sh' -exec shellcheck {} +" | ||
|
|
||
| # CIに統合(.github/workflows/ci.yml) | ||
| ``` | ||
|
|
||
| 2. **チームミーティング** (1時間) | ||
| - 技術的負債の現状共有 | ||
| - 優先順位の確認 | ||
| - リソース配分の決定 | ||
|
|
||
| ### 今月実行 | ||
|
|
||
| 1. **Issue #003: Node.jsバージョン統一** (6.5時間) | ||
| 2. **Issue #004: 基本統合テスト** (16時間) | ||
| 3. **Issue #002: shellcheck違反修正** (3.75時間) | ||
|
|
||
| ### 今四半期実行 | ||
|
|
||
| 1. **Issue #001: 包括的テスト実装** (96時間) | ||
| 2. **Issue #005: リファクタリング** (34時間) | ||
| 3. **Issue #006: ドキュメント改善** (開始、44時間) | ||
|
|
||
| ## リスク管理 | ||
|
|
||
| ### 主要リスク | ||
|
|
||
| 1. **テスト実装の遅延** (可能性: 中、影響: 高) | ||
| - 軽減策: 段階的実装、優先順位の明確化 | ||
|
|
||
| 2. **既存機能の破壊** (可能性: 低~中、影響: 高) | ||
| - 軽減策: リファクタリング前にテスト追加、段階的ロールアウト | ||
|
|
||
| 3. **リソース不足** (可能性: 中、影響: 中) | ||
| - 軽減策: 20%のスプリント容量を負債削減に割り当て | ||
|
|
||
| ## 進捗追跡 | ||
|
|
||
| 各Issueの進捗は以下で追跡: | ||
|
|
||
| - GitHub Issues: https://github.com/keito4/config/issues | ||
| - GitHub Projects: (該当する場合) | ||
| - 週次スタンドアップ: 進捗報告と障害の共有 | ||
|
|
||
| ## 参考資料 | ||
|
|
||
| - [技術的負債の測定](https://martinfowler.com/bliki/TechnicalDebt.html) | ||
| - [テスト駆動開発](https://www.amazon.co.jp/dp/4274217884) | ||
| - [Clean Code](https://www.amazon.co.jp/dp/4048930591) | ||
| - [Architecture Decision Records](https://adr.github.io/) | ||
|
|
||
| ## 貢献 | ||
|
|
||
| 技術的負債の改善に貢献する場合: | ||
|
|
||
| 1. 各Issueを確認 | ||
| 2. タスクリストから未完了項目を選択 | ||
| 3. ブランチを作成して実装 | ||
| 4. プルリクエストを作成 | ||
| 5. レビューを受ける | ||
|
|
||
| ## ライセンス | ||
|
|
||
| このドキュメントはリポジトリのライセンスに従います。 | ||
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.
Wrap bare URL in markdown link syntax.
The GitHub issues URL should use proper markdown link formatting.
Based on static analysis hints.
🔎 Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
289-289: Bare URL used
(MD034, no-bare-urls)
🤖 Prompt for AI Agents