Skip to content

Commit 54d9074

Browse files
authored
Merge PR #87: use Path.as_posix() for build_context paths (#86)
Replace str(rel) with rel.as_posix() in build_context and test helpers for consistent POSIX-style paths on Windows.
2 parents 01d77ac + bc6c542 commit 54d9074

6 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎src/skillspector/nodes/build_context.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ def _walk_skill_files(skill_dir: Path) -> list[str]:
9090
continue
9191
try:
9292
rel = item.relative_to(skill_dir)
93-
paths.append(str(rel))
93+
# Use forward slashes on every OS: these relative paths are dict keys
94+
# and SARIF/URI locations, so they must be portable (not OS-specific
95+
# backslashes on Windows).
96+
paths.append(rel.as_posix())
9497
except ValueError:
9598
logger.debug("Skipping path (not under skill_dir): %s", item)
9699
continue

‎tests/nodes/analyzers/test_semantic_developer_intent.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def _build_file_cache(skill_dir: Path) -> dict[str, str]:
342342
for item in sorted(skill_dir.rglob("*")):
343343
if not item.is_file():
344344
continue
345-
rel = str(item.relative_to(skill_dir))
345+
rel = item.relative_to(skill_dir).as_posix() # forward slashes on every OS
346346
try:
347347
cache[rel] = item.read_text(encoding="utf-8", errors="replace")
348348
except OSError:

‎tests/nodes/analyzers/test_semantic_security_discovery.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def _build_file_cache(skill_dir: Path) -> dict[str, str]:
317317
for item in sorted(skill_dir.rglob("*")):
318318
if not item.is_file():
319319
continue
320-
rel = str(item.relative_to(skill_dir))
320+
rel = item.relative_to(skill_dir).as_posix() # forward slashes on every OS
321321
try:
322322
cache[rel] = item.read_text(encoding="utf-8", errors="replace")
323323
except OSError:

‎tests/nodes/test_semantic_quality_policy.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def _build_file_cache(skill_dir: Path) -> dict[str, str]:
289289
for item in sorted(skill_dir.rglob("*")):
290290
if not item.is_file():
291291
continue
292-
rel = str(item.relative_to(skill_dir))
292+
rel = item.relative_to(skill_dir).as_posix() # forward slashes on every OS
293293
try:
294294
cache[rel] = item.read_text(encoding="utf-8", errors="replace")
295295
except OSError:

‎tests/test_mcp_least_privilege.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def _make_state(fixture_name: str) -> dict:
9898
continue
9999
if item.name.startswith(".") and not item.name.startswith(".claude"):
100100
continue
101-
rel = str(item.relative_to(fixture_dir))
101+
rel = item.relative_to(fixture_dir).as_posix() # forward slashes on every OS
102102
components.append(rel)
103103
components.sort()
104104

‎tests/test_mcp_tool_poisoning.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _make_state(
121121
continue
122122
if item.name.startswith(".") and not item.name.startswith(".claude"):
123123
continue
124-
rel = str(item.relative_to(fixture_dir))
124+
rel = item.relative_to(fixture_dir).as_posix() # forward slashes on every OS
125125
components.append(rel)
126126
components.sort()
127127

0 commit comments

Comments
 (0)