Refactor common code in coverare report