Clean up the check-spaces script
Cleaning up means
- converting indentation using tabs to spaces
- fixing unsafe constructs
- enabling pragmas to detect unsafe constructs in the future
Doing this as part of #5500 (moved).
Cleaning up means
Doing this as part of #5500 (moved).