Contributing
Setup
git clone https://github.com/disoardi/hadoopscope
cd hadoopscope
python3 tests/run_all.py # verify baseline
No virtual environment needed — the core uses only stdlib.
Coding rules
These are non-negotiable (see CLAUDE.md):
- Python 3.6+ compatible — no walrus operator, no dataclasses, no
f"{x:.2f}" - Zero pip dependencies for core (
checks/,alerts/,config.py,bootstrap.py) run()never raises — always returnCheckResult(status=UNKNOWN)on error- Use
# type: (...)annotations inline or import fromtypingexplicitly - No
|in type hints — useOptional[X],Union[X, Y]
Adding a new check
- Create or edit a file in
checks/ - Extend
CheckBase:
class MyCheck(CheckBase):
requires = [] # or [["ansible"]] if needed
def run(self):
# type: () -> CheckResult
try:
# ... your logic ...
return CheckResult("MyCheck", CheckResult.OK, "all good")
except Exception as e:
return CheckResult("MyCheck", CheckResult.UNKNOWN, str(e))
- Register it in
hadoopscope.py → build_check_registry() - Add a fixture + test in
tests/test_checks.py
Adding a new alert
- Create
alerts/my_alert.pywith adispatch(results, config, env_name)function - Import and call it in
hadoopscope.py → dispatch_alerts()
Pull requests
- Run
python3 tests/run_all.pybefore submitting - One feature/fix per PR
- Update docs if adding a new check or config option