Protokoll #15625
| ID | 15625 |
|---|---|
| Zeitstempel | 2025-12-25 16:55:53.400726 |
| Client | root |
| IP | Warning: Undefined array key "request_ip" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 |
| Modell | claude-sonnet-4-20250514 |
| Status | completed |
| Tokens | 1,040 (Input: 0, Output: 0) |
| Dauer | 87 ms |
| Request-Zeit | Warning: Undefined array key "request_timestamp" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 18 |
| Response-Zeit | - |
Warning: Undefined array key "error_message" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 22
Request
{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/tools\/ki-protokoll\/claude-hook\/quality\/rule_base.py"
}
}
Response
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/tools\/ki-protokoll\/claude-hook\/quality\/rule_base.py",
"content": "#!\/usr\/bin\/env python3\n\"\"\"\nBasis-Klasse für Quality-Gate-Regeln.\nStellt gemeinsame Funktionalität für alle Regel-Module bereit.\n\"\"\"\n\nimport re\nfrom pathlib import Path\nfrom typing import List, Callable\n\n\n# =============================================================================\n# ALLOWLIST DEFINITIONS\n# =============================================================================\n\nGLOBAL_ALLOWLIST = [\n \"\/vendor\/\",\n \"\/tests\/\",\n \"\/Test\/\",\n]\n\nDTO_ALLOWLIST = [\n \"\/Infrastructure\/DTO\/\",\n \"\/DTO\/\",\n]\n\nMIGRATION_ALLOWLIST = [\n \"\/migrations\/\",\n \"\/Migration\/\",\n]\n\n\n# =============================================================================\n# COMMON NUMBERS - Erlaubte Magic Numbers\n# =============================================================================\n\nCOMMON_NUMBERS = {\n '0', '1', '2',\n '10', '100', '1000',\n '60', '24', '365',\n '30', '31', '28', '29',\n '12', '52', '7',\n '200', '201', '204',\n '301', '302', '304',\n '400', '401', '403', '404', '500',\n}\n\n\n# =============================================================================\n# HELPER FUNCTIONS\n# =============================================================================\n\ndef is_in_allowlist(file_path: str, allowlist: list) -> bool:\n \"\"\"Prüft ob Pfad in Allowlist ist.\"\"\"\n return any(allowed in file_path for allowed in allowlist)\n\n\ndef count_non_empty_lines(content: str) -> int:\n \"\"\"Zählt nicht-leere Zeilen.\"\"\"\n return len([line for line in content.split('\\n') if line.strip()])\n\n\n# =============================================================================\n# RULE BASE CLASS\n# =============================================================================\n\nclass Rule:\n \"\"\"\n Basis-Klasse für alle Quality-Gate-Regeln.\n\n Jede Regel ist eine Callable-Klasse die file_path und content nimmt\n und eine Liste von Warnings zurückgibt.\n \"\"\"\n\n def __init__(self, allowlist: List[str] = None):\n \"\"\"\n Args:\n allowlist: Zusätzliche Allowlist-Pfade für diese Regel\n \"\"\"\n self.allowlist = allowlist or []\n\n def should_skip(self, file_path: str) -> bool:\n \"\"\"\n Prüft ob diese Datei übersprungen werden soll.\n\n Args:\n file_path: Pfad zur zu prüfenden Datei\n\n Returns:\n True wenn Datei übersprungen werden soll\n \"\"\"\n return is_in_allowlist(file_path, GLOBAL_ALLOWLIST + self.allowlist)\n\n def check(self, file_path: str, content: str) -> List[str]:\n \"\"\"\n Führt die Regel-Prüfung aus.\n\n Args:\n file_path: Pfad zur zu prüfenden Datei\n content: Dateiinhalt\n\n Returns:\n Liste von Warning-Messages\n \"\"\"\n raise NotImplementedError(\"Subclasses must implement check()\")\n\n def __call__(self, file_path: str, content: str) -> List[str]:\n \"\"\"\n Macht die Regel-Klasse callable.\n\n Args:\n file_path: Pfad zur zu prüfenden Datei\n content: Dateiinhalt\n\n Returns:\n Liste von Warning-Messages\n \"\"\"\n if self.should_skip(file_path):\n return []\n return self.check(file_path, content)\n\n\n# =============================================================================\n# RULE COLLECTION\n# =============================================================================\n\ndef collect_rules(rule_list: List[Callable]) -> List[Callable]:\n \"\"\"\n Sammelt alle Regeln aus einem Modul.\n\n Args:\n rule_list: Liste von Regel-Funktionen oder Regel-Klassen\n\n Returns:\n Liste von callables\n \"\"\"\n return rule_list\n",
"numLines": 138,
"startLine": 1,
"totalLines": 138
}
}
}