Raise TypeError if the config file is malformed

Fixes #1504.
I concur. It’s just that the method is at 16 lines already, so I’ll violate `Metrics/MethodLength` by being forced to break the line :-)

I’ll figure out something.