Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions anchor/core/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def scan_directory(self, dir_path: str, exclude_paths: List[str] = None,
prune_list = [
"build", "dist", "__pycache__", ".git", "node_modules",
"target", "venv", ".venv", ".cache", "docs", "artifacts",
".anchor", "tests", "benchmarks"
".anchor", "tests", "benchmarks", ".yarn", ".next", ".turbo",
"bower_components", "coverage", ".nyc_output", "storybook-static", "out"
]

if self.verbose:
Expand Down Expand Up @@ -540,7 +541,7 @@ def _get_suppression_author(self, file_path: str, line_num: int) -> str:
# -L <start>,<end> : only blame the specified line
# --porcelain : machine-readable format
cmd = ["git", "blame", "-L", f"{line_num},{line_num}", "--porcelain", abs_path]
result = subprocess.run(cmd, capture_output=True, text=True, check=True) # anchor: ignore ANC-018
result = subprocess.run(cmd, capture_output=True, text=True, check=True, timeout=2) # anchor: ignore ANC-018
Comment on lines 541 to +544
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PolicyEngine defines _get_suppression_author twice in this class (another definition earlier in the file). The earlier definition is overwritten by this one, which makes behavior dependent on definition order and likely unintended; please remove/merge into a single implementation with a consistent fallback/return value.

Copilot uses AI. Check for mistakes.

Comment on lines +544 to 545
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new timeout=2 on git blame can cause TimeoutExpired on slower machines/large repos, which will hit the broad except and fall back to the default author string even for committed lines. Consider handling TimeoutExpired separately (e.g., longer timeout and/or return a distinct "Unknown"/"Blame timed out" value) so suppression attribution isn’t silently wrong.

Copilot uses AI. Check for mistakes.
# 3. Parse author from porcelain output
for line in result.stdout.splitlines():
Expand Down
Loading