This is a redo of https://github.com/bitcoin/bitcoin/pull/15141/commits/7721ad64f40a0c67edefaaf7353264d78df8803e
I used some sed magic:
sed -n '/\.DoS(/{ :loop N; s/,\n\s*/, /; s/\n\s*//; /\.DoS(.*;/!b loop}; p' -i ../src/validation.cpp ../src/consensus/tx_verify.cpp