Skip to content

Limit Hazard.__init__() responsibilities

Michał Kępień requested to merge michal/limit-hazard-init-responsibilities into main

Opening and reading dangerfile.py is only truly necessary in Hazard.evaluate(). Move the relevant code from Hazard.__init__() to Hazard.evaluate() to better represent the responsibilities of each of these methods. This also relieves auto() from having to open dangerfile.py itself, making its testing easier.

The callbacks for message(), warn(), and fail() are only used in Hazard.evaluate(). Move the kwargs enabling these callbacks to be overridden (for testing purposes) from Hazard.__init__() to Hazard.evaluate() to better represent the responsibilities of each of these methods.

Merge request reports