MCPcopy Create free account
hub / github.com/ParzivalHack/PySpector / __init__

Method __init__

src/pyspector/stats.py:47–82  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

45class StatsCollector:
46
47 def __init__(self) -> None:
48 # Timing
49 self._t_start: Optional[float] = None
50 self._t_end: Optional[float] = None
51
52 # File metrics
53 self.files_scanned: int = 0
54 self.files_skipped: int = 0
55 self.parse_errors: int = 0
56 self.total_loc: int = 0
57
58 # Rule metadata
59 self.rules_count: int = 0
60 # rule_id → "regex" | "ast" | "taint"
61 self._rule_detection: Dict[str, str] = {}
62
63 # Issue counters
64 self.pre_filter_count: int = 0 # raw from Rust (post dedup)
65 self.severity_filtered: int = 0 # dropped by --severity threshold
66 self.baseline_ignored: int = 0 # dropped by baseline file
67 self.final_issues: List[Any] = []
68
69 # Per-engine breakdown
70 self.regex_findings: int = 0
71 self.ast_findings: int = 0
72 self.taint_findings: int = 0
73
74 # Resource usage (populated by background thread)
75 self.peak_memory_mb: Optional[float] = None
76 self.cpu_cores_logical: Optional[int] = None
77 self.avg_cpu_percent: Optional[float] = None
78 self._cpu_samples: List[float] = []
79
80 self._mon_thread: Optional[threading.Thread] = None
81 self._stop_evt = threading.Event()
82 self._psutil_ok: bool = False
83
84
85 def start(self) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected