Jelle van der Waa bio photo

Jelle van der Waa

I'm a software developer at Kopano and an Arch Linux Developer...

Email Twitter Google+ LinkedIn Github Steam

So I started working on LibreOffice’s easyhacks, there are numerous hacks in different categories. But I quickly discovered I didn’t want to dive in the complicated or time consuming bugs. Luckily the easyhacks wiki has a lot of bugs that don’t require a lot of knowledge of LibreOffice’s internals.

The first bug I stumbled on was “remove pointless comments and ASCII art”, so this seems like an easy bug. The bug is about useless comments in the Libreoffice codebase, an example of this bug can be found here. And I soon discovered that the scale of these comments is mind-boggling as a quick “git grep” is showing.

git grep -E '\/\/[-=_#\.]{12,}' | wc -l
46482

With this regex and sed I could easily remove a lot of these comments as you can see in the code below.

find moduledirectory -name "*.cxx"  > files 
find moduledirectory -name "*.hxx"  >> files 

sed -r -i '/\/\/[-=_#\.]{12,}/d' `cat files`

Although I am still surprised that developers created these comments, I’m happy that I’ve found an easy way to improve readability of LibreOffice’s codebase and getting rid of ~ 46000 useless lines.