Skip to content

Commit 1c796a5

Browse files
committed
fix: address non-blocking reviewer nits from #140, #141, #143
- Remove "other" from _NON_EXECUTABLE_FILE_TYPES so extensionless scripts (inferred as "other") get code-example findings downweighted instead of hard-dropped (#140 nit) - Guard f.severity.upper() with None fallback in _fallback_filtered to match the codebase convention of (f.severity or "LOW").upper() (#143 nit) - Clarify --recursive help text to say "immediate subdirectories" instead of implying full recursive tree walk (#141 nit)
1 parent b1586b7 commit 1c796a5

5 files changed

Lines changed: 33 additions & 3 deletions

File tree

‎src/skillspector/cli.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def scan(
177177
typer.Option(
178178
"--recursive",
179179
"-r",
180-
help="Scan directories containing multiple skills (immediate subdirectories with SKILL.md) independently.",
180+
help="Scan immediate subdirectories that each contain a SKILL.md as independent skills.",
181181
),
182182
] = False,
183183
verbose: Annotated[

‎src/skillspector/nodes/analyzers/static_runner.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _is_eval_dataset(path: str) -> bool:
8484
_DOCUMENTATION_CONFIDENCE_FACTOR = 0.3
8585
_CODE_EXAMPLE_CONFIDENCE_FACTOR = 0.5
8686

87-
_NON_EXECUTABLE_FILE_TYPES = frozenset({"markdown", "text", "json", "yaml", "toml", "other"})
87+
_NON_EXECUTABLE_FILE_TYPES = frozenset({"markdown", "text", "json", "yaml", "toml"})
8888

8989

9090
def _is_documentation_markdown(path: str) -> bool:

‎src/skillspector/nodes/meta_analyzer.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def _fallback_filtered(findings: list[Finding]) -> list[Finding]:
236236

237237
result: list[Finding] = []
238238
for f in findings:
239-
severity_upper = f.severity.upper()
239+
severity_upper = (f.severity or "LOW").upper()
240240
confidence = f.confidence
241241
if f.context and is_code_example(f.context):
242242
confidence *= _CODE_EXAMPLE_DOWNWEIGHT

‎tests/nodes/analyzers/test_static_runner_filtering.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ def test_finding_in_executable_not_dropped_by_generic_indicator(self) -> None:
115115
for f in tm1_findings:
116116
assert f.confidence > 0
117117

118+
def test_extensionless_file_not_hard_dropped_by_code_example(self) -> None:
119+
"""An extensionless file (inferred as 'other') in code-example context is downweighted, not dropped."""
120+
content = """\
121+
#!/bin/bash
122+
# Example: cleanup old builds
123+
rm -rf /tmp/build-cache
124+
"""
125+
state = {
126+
"components": ["cleanup_script"],
127+
"file_cache": {"cleanup_script": content},
128+
}
129+
findings = static_runner.run_static_patterns(state, [tm_module])
130+
tm1_findings = [f for f in findings if f.rule_id == "TM1"]
131+
assert len(tm1_findings) >= 1, (
132+
"Extensionless files must not have code-example findings hard-dropped"
133+
)
134+
118135
def test_skill_md_findings_are_not_filtered_by_backticks(self) -> None:
119136
"""SKILL.md is the primary instruction file — backticks alone shouldn't filter."""
120137
content = """\

‎tests/nodes/test_meta_analyzer_fallback.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ def test_low_severity_below_threshold_still_dropped(self) -> None:
9999
assert len(result) == 0
100100

101101

102+
def test_none_severity_treated_as_low(self) -> None:
103+
"""Finding with None severity does not crash — treated as LOW."""
104+
findings = [_finding(confidence=0.8, severity=None)]
105+
result = _fallback_filtered(findings)
106+
assert len(result) == 1
107+
108+
def test_none_severity_below_threshold_dropped(self) -> None:
109+
"""None severity at low confidence is dropped (no severity floor protection)."""
110+
findings = [_finding(confidence=0.3, severity=None)]
111+
result = _fallback_filtered(findings)
112+
assert len(result) == 0
113+
114+
102115
class TestCodeExampleFiltering:
103116
"""Findings in code example context are downweighted, not hard-dropped."""
104117

0 commit comments

Comments
 (0)