Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteca919f

Browse files
jaggederestclaude
andcommitted
refactor: extract helper functions from monolithic activate() in extension.ts
- Extract setupRemoteSSHExtension() to configure remote SSH extensions- Extract initializeInfrastructure() to create storage and logger instances- Extract initializeRestClient() to setup REST API client- Extract setupTreeViews() to create workspace providers and tree views- Extract registerUriHandler() to handle vscode:// URIs (136 lines)- Improve test coverage from 39.71% to 71.02% for extension.ts- Add comprehensive tests for all extracted functions using TDD approach- Overall project coverage increased to 77.28%This refactoring improves code maintainability by breaking down the 400+ lineactivate() function into smaller, focused, testable functions.🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
1 parent6285043 commiteca919f

File tree

3 files changed

+664
-31
lines changed

3 files changed

+664
-31
lines changed

‎TODO.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,22 @@
4646

4747
###Refactoring Priority
4848

49-
1.**extension.ts** (38.68% coverage) - extract initialization logic
49+
1.**extension.ts** (39.71% → 71.02% coverage ✅) - Break down monolithic activate() function
50+
51+
Extract these helper functions (TDD - write tests first):
52+
53+
-[x] setupRemoteSSHExtension() - Configure remote SSH extension
54+
-[x] initializeInfrastructure() - Create storage and logger
55+
-[x] initializeRestClient() - Setup REST client
56+
-[x] setupTreeViews() - Create workspace providers and trees
57+
-[x] registerUriHandler() - Handle vscode:// URIs
58+
-[ ] registerCommands() - Register all VS Code commands
59+
-[ ] handleRemoteEnvironment() - Setup remote workspace if needed
60+
-[ ] checkAuthentication() - Verify user auth and fetch workspaces
61+
-[ ] handleAutologin() - Process autologin configuration
62+
63+
Approach: Extract one function at a time, add tests, maintain passing suite
64+
5065
2.**remote.ts** (49.21% coverage) - break down 400+ line methods
5166
3.**commands.ts** (64.19% coverage) - create UI abstraction layer
5267

@@ -59,22 +74,23 @@
5974

6075
##Success Metrics
6176

62-
| Metric| Target| Current| Status|
63-
| ------------------------| ------| -------| -----------|
64-
| Unit test coverage| 80%+|74.97%| 🔄 Progress|
77+
| Metric| Target| Current| Status|
78+
| ------------------------| ------| ---------------------| -----------|
79+
| Unit test coverage| 80%+|77.28%| 🔄 Progress|
6580
| Integration tests| 60+| 69| ✅ Complete|
6681
| Logger adoption| 100%| 100%| ✅ Complete|
67-
| Files with <50% coverage| 0|3| 🔄 Progress|
82+
| Files with <50% coverage| 0|1| 🔄 Progress|
6883

6984
##Immediate Next Steps
7085

71-
1.**Clean up api.test.ts**
86+
1.**Refactor extension.ts using TDD**
87+
88+
- Start with setupRemoteSSHExtension() - write test first
89+
- Continue with initializeInfrastructure() and other functions
90+
- Run`yarn test:ci --coverage` after each extraction
91+
- Target: 39.71% → 60%+ coverage
7292

93+
2.**Clean up api.test.ts**
7394
- Remove eslint-disable comment
7495
- Create proper mock types for 30+`as any` casts
7596
- Consider exposing test interfaces for better type safety
76-
77-
3.**Improve low-coverage files**
78-
- extension.ts: 38.68% → 60%+ (extract initialization)
79-
- remote.ts: 49.21% → 70%+ (break down large methods)
80-
- commands.ts: 64.19% → 75%+ (UI abstraction)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp