Closed dBitech closed 4 years ago
It looks like @hoche is on the way to defining a style in Contributing.md.
It sounds like clang-format would be a nice enforcement tool. However, I know I'm temporarily breaking the coding standard left and right while I work on #6. Once I can get my stuff merged in, I'll start working closer to the coding standard. So perhaps we can implement clang-format after things have settled down a little.
Speaking of coding standard, I'm a big fan of Doxygen. However, it requires specific comment formats, either: /**
or ///
. /**
is common for Java and C, ///
is common for C++. May we standardize on Doxygen comments? If we do, may we pick the ///
style? I ask for this style because XCode can automatically generate that style but not the Javadoc (/**
) style. As of 2020, I believe Eclipse CDT can automatically generate both styles. CMake can generate projects for both IDEs. I haven't found good Doxygen support in Visual Studio yet, however.
the .clang-format style I'm proposing is based on the Google C++ style with 4 spaces as per Contributing.md We certainly could get the tooling in place to support linting via clang-format and once happy with its styling look to add the pre-commit hook.
PR 18
Yeah, I'm ok with requiring clang-format and doxygen. @dBitech Do you already have a .clang-format file? If not I can fiddle a bit and put one together.
I picked the Google style because it's the most complete and many people are familiar with it. I picked 4 spaces because...well, it's what I've been using for 35 years and I think it's a nice compromise between visibility and not taking up two much horizontal space.
That being said, I think my code style here has varied depending on what other things I was working on at the time. I'll try to clean up some of that going forward.
And yeah, it's a little early to start enforcing this stuff at check-in time, but we should probably try to get to that point fairly soon.
Next you guys are going to want me to set up a CI system, huh.
implemented (to start) in commit/cafab05cf503595a9b690c1ca917ca91af1590db I think this can now be closed.
Use clang-format tool (part of the LLVM projects) to enforce a consistent style for new and refactored code.
Add a pre-commit hook to ensure style is consistent. The issue was opened to allow for discussion, PR for consideration forthcoming.