"""Fallback parser — used when no language-specific parser claims the recipe. Behavior is intentionally minimal. We don't try to extract anything from arbitrary stdout for unknown (language, recipe) combos — that's a v0.2 problem. All we do is: if the recipe exited non-zero, emit a single ``recipe_fail`` finding so the digest can flag "something went wrong" without hand-grepping the log. exit_code 0 = no findings. """ from __future__ import annotations from .base import Finding class GenericParser: @classmethod def matches(cls, language: str, recipe: str) -> bool: # Always true — the registry uses this as the last-resort fallback. return True @classmethod def parse(cls, raw_log: str, exit_code: int, recipe: str) -> list[Finding]: if exit_code == 0: return [] return [ Finding( kind="recipe_fail", severity="warn", code=f"exit_{exit_code}", message=( f"recipe '{recipe}' exited with status {exit_code}; " f"see job log for details" ), ) ]