This week I focused on adding clang-format
to my code to have better consistency when other developers are contributing. I chose this as it has a VSCode extension and works very well with C++ which is what my project is written in.
I added settings in the .vscode
folder to ensure that every time a user saves their work, the code is automatically formatted according to the .clang-format
file requirements. Originally, there was a script I created, but I decided to remove it as it wasn't very necessary when VSCode automatically formats it anyway.
After running it on my code, I noticed it had found many things it didn't like. It mostly indented long lines into shorter lines for easier readability. It also moved some braces around.
I finally learned how I can integrate formatters into my IDE and make it easier for developers to contribute. That is what Github is all about after all!
Top comments (0)