There are two setting within the CKeditor that control the formatting of the source. They are:
By default these are set to false, you will need to udpate them to be true to get the source code to be properly formatted.
You will find these settings in several of the files, you can update it with a global find and replace. If you just want to update the formatting of the source code then you only need to update the FormatSource setting, if you would like to update how the output is formatted then you can update the FormatOutput setting.
for FormatSource, do a site wide find and replace with these values:
FCKConfig.FormatSource = false
FCKConfig.FormatSource = true
for FormatOutput do the same but look for these values:
FCKConfig.FormatOutput = false
FCKConfig.FormatOutput = true