-
Notifications
You must be signed in to change notification settings - Fork 0
Detector: Inline Comment Drift
Jacob Centner edited this page Apr 13, 2026
·
1 revision
Detects docstrings that no longer accurately describe their function or class implementation.
| Property | Value |
|---|---|
| Name | inline-comment-drift |
| Tier | LLM_ASSISTED |
| Languages | Python |
| External tool | None |
| LLM required |
Yes — minimum basic capability tier |
| Confidence | 0.55 (basic), 0.70 (enhanced) |
Stale docstrings where the documented behavior no longer matches the code:
- Wrong parameter names or types
- Incorrect return type/value descriptions
- Described behavior that doesn't exist in the implementation
- Wrong examples in docstrings
This detector focuses on factual inaccuracies, not style or completeness.
- Discovers Python files, prioritized by risk signals (churn + fix ratio)
- Parses AST to extract
(docstring, code body)pairs for functions and classes - Sends each pair to the LLM asking if the docstring is factually wrong
- Parses structured JSON response (
needs_review,reason, optionalseverity) - Logs every LLM call to the database
| Parameter | Value |
|---|---|
| Min docstring length | 30 characters |
| Max per file | 20 docstrings |
| Max per scan | 100 docstrings |
| Truncation (basic) | 600 / 1500 chars (doc / code) |
| Truncation (enhanced) | 1200 / 3000 chars (doc / code) |
| Tier | Behavior |
|---|---|
basic |
Binary "factually wrong or not" judgment, shorter context, confidence 0.55 |
standard+ |
5-point checklist (params, return type, side effects, examples, etc.), larger context, confidence 0.70, LLM can report severity |
[INLINE-COMMENT-DRIFT] src/sentinel/core/runner.py:run_scan (line 45)
Docstring says it returns a list of findings, but the function
returns a ScanResult dataclass.
Severity: MEDIUM, Confidence: 0.55
[sentinel]
model = "qwen3.5:4b" # Works for clear factual errors
# model = "gpt-5.4-nano" # Better for subtle semantic driftLocal Repo Sentinel · MIT License
Getting Started
Reference
Detectors
- Detector: Todo Scanner
- Detector: Complexity
- Detector: Dead Code
- Detector: Dep Audit
- Detector: Docs Drift
- Detector: Unused Deps
- Detector: Lint Runner
- Detector: ESLint Runner
- Detector: Go Linter
- Detector: Rust Clippy
- Detector: Git Hotspots
- Detector: Stale Env
- Detector: Semantic Drift
- Detector: Test Coherence
- Detector: CI/CD Drift
- Detector: Architecture Drift
- Detector: Inline Comment Drift
- Detector: Intent Comparison
Advanced
Workflow