Skip to content

fix: expand tilde (~) in project_path to prevent silent failures#153

Merged
rahlk merged 1 commit into
mainfrom
fix/tilde-expansion-in-project-path
May 17, 2026
Merged

fix: expand tilde (~) in project_path to prevent silent failures#153
rahlk merged 1 commit into
mainfrom
fix/tilde-expansion-in-project-path

Conversation

@rahlk
Copy link
Copy Markdown
Collaborator

@rahlk rahlk commented May 17, 2026

Summary

  • Paths like "~/workspace/project" were not expanded, causing Path("~/...") to interpret ~ as a literal directory name
  • This led to empty analysis results and spurious ./~/ directories being created

Changes

  • core.py: normalize project_path with expanduser().resolve() and validate directory exists before dispatching to backends
  • codeanalyzer.py: defensive expansion in PyCodeanalyzer for direct instantiation, plus same treatment for cache_dir/analysis_json_path

Test plan

  • Verified tilde paths now expand correctly
  • Verified non-existent paths raise CldkInitializationException with clear message

Paths like "~/workspace/project" were not expanded, causing Path("~/...")
to interpret ~ as a literal directory name. This led to empty analysis
results and spurious ./~/ directories.

Changes:
- core.py: normalize project_path with expanduser().resolve() and
  validate directory exists before dispatching to backends
- codeanalyzer.py: defensive expansion in PyCodeanalyzer for direct
  instantiation, plus same treatment for cache_dir/analysis_json_path
@rahlk rahlk merged commit 1c91e23 into main May 17, 2026
@rahlk rahlk deleted the fix/tilde-expansion-in-project-path branch May 17, 2026 22:02
@rahlk rahlk added the bug Something isn't working label May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant