There are two setting within the CKeditor that control the formatting of the source. They are:
FCKConfig.FormatSource
FCKConfig.FormatOutput
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:
find:
FCKConfig.FormatSource = false
replace with:
FCKConfig.FormatSource = true
for FormatOutput do the same but look for these values:
find:
FCKConfig.FormatOutput = false
replace with:
FCKConfig.FormatOutput = true