mirror of
https://github.com/JamesTheGiblet/BuddAI.git
synced 2026-01-08 21:58:40 +00:00
- Implemented comprehensive unit tests for the BuddAI Analytics module, covering fallback statistics calculations. - Created tests for the FallbackClient to ensure proper escalation to various AI models and handling of missing API keys. - Developed unit tests for the refactored validator system, validating various hardware and coding standards. - Established a base validator interface and implemented specific validators for ESP32, Arduino, motor control, memory safety, and more. - Enhanced the validator registry to auto-discover and manage validators effectively. - Included detailed validation logic for common issues in embedded systems programming, such as unused variables, safety timeouts, and coding style violations.
63 lines
2.2 KiB
Python
63 lines
2.2 KiB
Python
from typing import List, Dict
|
|
|
|
class BaseValidator:
|
|
def validate(self, code: str, hardware: str, user_message: str) -> List[Dict]:
|
|
"""Return a list of issues found."""
|
|
return []
|
|
|
|
def find_line(self, code: str, substring: str) -> int:
|
|
for i, line in enumerate(code.splitlines(), 1):
|
|
if substring in line:
|
|
return i
|
|
return -1
|
|
|
|
from .esp32_basics import ESP32Validator
|
|
from .motor_control import MotorValidator
|
|
from .servo_control import ServoValidator
|
|
from .memory_safety import MemoryValidator
|
|
from .forge_theory import ForgeTheoryValidator
|
|
from .timing_safety import TimingValidator
|
|
from .arduino_compat import ArduinoValidator
|
|
from .style_guide import StyleValidator
|
|
from typing import List, Dict
|
|
|
|
class BaseValidator:
|
|
def validate(self, code: str, hardware: str, user_message: str) -> List[Dict]:
|
|
"""Return a list of issues found."""
|
|
return []
|
|
|
|
def find_line(self, code: str, substring: str) -> int:
|
|
for i, line in enumerate(code.splitlines(), 1):
|
|
if substring in line:
|
|
return i
|
|
return -1
|
|
|
|
from .esp32_basics import ESP32Validator
|
|
from .motor_control import MotorValidator
|
|
from .servo_control import ServoValidator
|
|
from .memory_safety import MemoryValidator
|
|
from .forge_theory import ForgeTheoryValidator
|
|
from .timing_safety import TimingValidator
|
|
from .arduino_compat import ArduinoValidator
|
|
from .style_guide import StyleValidator
|
|
from typing import List, Dict
|
|
|
|
class BaseValidator:
|
|
def validate(self, code: str, hardware: str, user_message: str) -> List[Dict]:
|
|
"""Return a list of issues found."""
|
|
return []
|
|
|
|
def find_line(self, code: str, substring: str) -> int:
|
|
for i, line in enumerate(code.splitlines(), 1):
|
|
if substring in line:
|
|
return i
|
|
return -1
|
|
|
|
from .esp32_basics import ESP32Validator
|
|
from .motor_control import MotorValidator
|
|
from .servo_control import ServoValidator
|
|
from .memory_safety import MemoryValidator
|
|
from .forge_theory import ForgeTheoryValidator
|
|
from .timing_safety import TimingValidator
|
|
from .arduino_compat import ArduinoValidator
|
|
from .style_guide import StyleValidator
|