Too Lazy for Indentating mah scripts
Posted: 08 Sep 2012, 19:43
Yes, there are alot of spring scripts, and probably you find that (hopefully not much) some of them have a very hard to read indentation (or none) and you will find yourself trying to decrypt that code while preparing your evil plan for killing the lazy programmer that didn't care his indentations
BUT NOW there is a partial solution for this problem, Cubex presents:
The Reindentator!
This Python written script will get a Source folder (yes a folder, for doing it automatically instead of one by one :D) and a Destination folder, then will proceed to walk across the files to find any lua script and will try to replace his indentation for a freshly automatic generated one :) saving you hours and hours of eye bleedings
Why? well, cause i tried to read PicassoCT made lua script's, they are with too badly indented and I am too lazy for reindenting all myself
WARNING! This script is nowhere near safe, it can containg undiscovered bug and behaviors, I tested myself with some badly indented scripts and works almost all cases, if you got "[ERROR] Negative Depth! Line...blablabla" means that my script can't resolve it or there is some missing end (don't trust, sometimes fails even with good if - end pairs :/, in case of failure the original file is copied to Dest folder without any modification)
tl;dr
Program for Reindenting scripts, Don't try to reindent a corretly indented script. Ony for emergency cases
How to use:
Needs Python 3 (Tested with Python 3.2, not sure if works with 2.x, but is sould...)
open console, run program with Reindentator.py and see help text
Lua Disclamer:
Cubex not harmed any lua script in the creation of this script
BUT NOW there is a partial solution for this problem, Cubex presents:
The Reindentator!
This Python written script will get a Source folder (yes a folder, for doing it automatically instead of one by one :D) and a Destination folder, then will proceed to walk across the files to find any lua script and will try to replace his indentation for a freshly automatic generated one :) saving you hours and hours of eye bleedings
Why? well, cause i tried to read PicassoCT made lua script's, they are with too badly indented and I am too lazy for reindenting all myself
WARNING! This script is nowhere near safe, it can containg undiscovered bug and behaviors, I tested myself with some badly indented scripts and works almost all cases, if you got "[ERROR] Negative Depth! Line...blablabla" means that my script can't resolve it or there is some missing end (don't trust, sometimes fails even with good if - end pairs :/, in case of failure the original file is copied to Dest folder without any modification)
tl;dr
Program for Reindenting scripts, Don't try to reindent a corretly indented script. Ony for emergency cases
How to use:
Needs Python 3 (Tested with Python 3.2, not sure if works with 2.x, but is sould...)
open console, run program with Reindentator.py and see help text
Lua Disclamer:
Cubex not harmed any lua script in the creation of this script