Scale Addons code cleanup:
Always bail out of functions ASAP, do not calculate unnecessary stuff before.
Merged if-condition checks.
Declaration and assignment of local variables in one line.
Reduced the scope of some variables.
Use pre- instead of postfix in- and decrements.
Added and removed newlines where appropriate.
Added brackets to foreach macro loops and removed them otherwise (if redundant).
Fixed indentation.
Note:
This plugin has a huge chunk of code, which has been commented out.
(apparantly/according to the comment, because it does not work)
I was very cautious in refactoring this part of the code, as it currently is
excluded from compilation and thus cannot be tested.
TODO: Test, repair and integrate this code (or remove it if it is redundant).
TODO: Fix half-broken "Exit Scale On Pull".
TODO: Fix the scale-will-only-terminate-if-initiate_key-is-defined bug.
Approved by PS Jenkins bot, Sam Spilsbury.