Skip to content

refactor: code cleanup — named constants, dedup, naming consistency, XML docs - #27

Merged
pexatar merged 1 commit into
mainfrom
refactor/code-cleanup
May 5, 2026
Merged

pexatar merged 1 commit into
mainfrom
refactor/code-cleanup

Conversation

@pexatar

@pexatar pexatar commented May 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Named constants per magic numbers in CardTypeDetector (BIN ranges), PasswordStrengthAnalyzer (time conversions), PasswordGenerator (length bounds), MergeService (note snippet size)
  • MergeService refactor: eliminates 4 identical merge loops via new generic MergeCollection<T>() helper (~44 duplicated lines removed)
  • ListViewHelpers: new Helpers/ListViewHelpers.cs with ShowSavedToast(TeachingTip, Action?) centralising identical toast boilerplate from 4 list-view code-behind files
  • Naming consistency: _res → _resourceLoader in all 9 view files
  • XML documentation: /// <summary> added to all 18 [ObservableProperty] declarations in DashboardViewModel

Test plan

  • dotnet build PassKey.sln -p:Platform=x64 — 0 errors, 0 warnings
  • dotnet test — 176/176 pass
  • Installer built and verified locally by user

🤖 Generated with Claude Code

…XML docs

- CardTypeDetector: extract BinRanges nested class with 10 named constants
  for all BIN/IIN prefix ranges (MasterCard, Discover, JCB, Diners Club)
- PasswordStrengthAnalyzer: extract TimeConstants nested class (SecondsPerMinute
  through SecondsPerMillennium) replacing magic literals in EstimateCrackTime()
- PasswordGenerator: add MinPasswordLength=8 / MaxPasswordLength=128 constants
- MergeService: add NoteHashSnippetLength=256 constant; extract MergeCollection<T>()
  generic helper — eliminates 4 identical merge loops (~44 duplicated lines)
- Add Helpers/ListViewHelpers.cs with ShowSavedToast(TeachingTip, Action?)
  centralising identical toast boilerplate from 4 list-view code-behind files
- Rename _res → _resourceLoader in all 9 view files for naming clarity
- DashboardViewModel: add XML <summary> documentation to all 18 ObservableProperty
  declarations (greeting, stat cards, weekly activity, health, search)

Build: 0 errors, 0 warnings. Tests: 176/176 pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pexatar
pexatar merged commit 3e07046 into main May 5, 2026
1 check passed
@pexatar
pexatar deleted the refactor/code-cleanup branch May 5, 2026 11:06
@pexatar pexatar mentioned this pull request May 14, 2026
12 tasks
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