-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto formatter? #8
Comments
On Julius/augustus we use editorconfig files. They're compatible with at least VS2022 and VSCode by using extensions for both, I don't know about other IDEs though. |
Good to know. I'm actually using VSCode. Lets see what Banderi says. |
I do have Clang enabled on CLion, it helps a lot! Though I don't think I have any linter action enabled (yet), if it exists within Clang's capability. For the time being I've just been formatting things mostly manually. |
yes there is also Clang-Format which can use Clang-Format file from the root folder to automatically format based on certain rules. I can also add some file which adds some sane formatting. But of course It can be modified how the auto format should be. For Clion maybe this helps: https://www.jetbrains.com/help/clion/clangformat-as-alternative-formatter.html#review-settings |
Coming back to this I really thing we should use some auto formatter it will save some time. I can try out some things the next day and maybe provide this clang format file with instructions how it works. |
For the basics I think yes, my IDE automatically formats things as I set it up (either via Clang or something else internally) e.g.:
When it comes to more macroscopic things though I do manually; |
Maybe in one of the next commits I can try it with a clang format file. It does not force everything (like not force on line limit) but it helps keep the code consistent. Regarding ++i, i++ Regarding omitting bracets on one liner ifs. e.g.
Later you also want to add c:
With intention one could think b and c gets executed inside the if but it does not. So I always do
|
Yes, I realize it's unrecommended if you want to be 100% safe for posterity, but after considering everything I still decided I prefer without extra braces; it looks cleaner to me, it's less fluff and less symbols all around. |
For me it is just a "brainfuck" because all the projects i worked on in c/c++ forbid it and also everything else needs brackets so its just natural to add them for me. So the question is now is it optional to have them or do they need to be removed? |
Ahh, darn. I totally get ya.... for me it's the same, but exactly the opposite haha. I get my eyes crossed if I see them and always remove them unfortunately. Is there a way maybe to have a linter that only shows them or hides them on one's own end/IDE? |
I was wondering if there is some kind of auto formater for the code in the project?
If not I suggest we could add something like Clang Format file which formats you the code on save etc.
The text was updated successfully, but these errors were encountered: