Skip to content

Bug: Tilde (~) in project_path not expanded, causes silent empty results #154

@rahlk

Description

@rahlk

Description

When passing a path containing ~ (e.g., "~/workspace/project") to CLDK.analysis(), the tilde is not expanded. This causes the analyzer to interpret ~ as a literal directory name relative to the current working directory, leading to:

  1. Silent empty results (empty PyApplication with no classes/methods)
  2. Creation of spurious directories like ./~/workspace/.../.codeanalyzer/

Reproduction

from cldk import CLDK

pa = CLDK("python").analysis("~/workspace/codellm-devkit/codeanalyzer-python")
pa.get_application_view()  # Returns empty PyApplication

Root Cause

Path("~/...") does not expand ~ — it must be explicitly expanded via .expanduser(). The SDK was passing the path directly to Path() without expansion in:

  • cldk/core.pyanalysis() method
  • cldk/analysis/python/codeanalyzer/codeanalyzer.pyPyCodeanalyzer.__init__()

Expected Behavior

  • Tilde should be expanded to the user's home directory
  • Invalid/non-existent paths should raise a clear error, not return empty results

Fix

Call .expanduser().resolve() on path inputs and validate the directory exists before proceeding with analysis.

Fixed in: #153

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions