This website uses cookies to ensure you get the best experience. Learn More.
Fast format-source (for Liferay developers and contributors)
A lot of effort is put into keeping Liferay huge source base formatted consistently, what is very important. There is an advance source formatter (ant format-source) that outputs formatting problems and even corrects some for you. However, since the code base is huge, this task may take several minutes to finishes. Another minor issue is that all sources is scanned, so if someone commit badly formatted source, you will get his formatting problems; his files might be modified and therefore become a part of your changelist.
Some time ago, Zsolt Balogh gave me a great idea: instead of scanning the whole source base, lets just scan the modified files. So that's exactly what I did - and the whole formatting process now takes only few seconds to complete:) Here is my implementation of this idea.
I've made a little IntelliJ plugin that creates a temp file with list of modified files and then executes user-defined external command, passing the temp file name as an argument.
A little program that:
So, formatting will look only on the changeset files. Here is the current version of this tool (without the jars, use them from portal). Take a look into the .bat for more info. Please note that this is just the first version,so it will change in the future - but the concept stays the same.
The result appears after few seconds (or less) in a new tool window, as in example below:
I already see some places for improvement and will probably enhance the plugin and the tool in my free time (in my what?:), but, like i've said, the core concept is here and it works.