blocksds / sdk

Main BlocksDS SDK repository
https://blocksds.github.io/docs/
130 stars 5 forks source link

Unified code style across BlocksDS-maintained projects #168

Open asiekierka opened 2 weeks ago

asiekierka commented 2 weeks ago

clang-format exists, let's make use of it.

I have no strong opinions here, other than that:

AntonioND commented 1 week ago

I've spent a few hours with clang-format and "Artistic Style" https://astyle.sourceforge.net/ and I'm pretty disappointed with the results of the tools in general.

clang-format:

Artistic Style:

In short... for now, let's not do this. I may spend a bit of time writing a document with some broad code style rules, and leave the rest to the discretion of the developer.

profi200 commented 1 week ago

That reminds me of a little story from years ago when #3dsdev on EFNet was still active. Someone opened an issue regarding clang-format to add single line if(). One of the devs responded how the code styles they offer are superior and the issue got closed. So yeah, don't rely on these tools too much. It's time consuming but formatting by hand gives the best results.

AntonioND commented 1 week ago

Well, it looks like libnds is probably an exception. DSWiFi has taken quite a bit of work to manually change a few parts that caused clang-format to freak out. However, I have created a .clang-format file that generates code that looks basically like what I was aiming for in libnds, and I haven't had to disable it anywhere: https://github.com/blocksds/dswifi/commit/5894e8d8fa50e95d785ed992d25571c126c5d883

Same for libteak: https://github.com/blocksds/libteak/commit/eeb96d7291200191664bc4bff6429651d700f35c