Inconsistencies between .clang-format
file version and what is used in CI
#9231
Replies: 3 comments
-
The C/C++ options in the file just haven't been revisited in a very long time. Generally we use the clang-format version Visual Studio currently ships with as a guideline, which is 13 right now. |
Beta Was this translation helpful? Give feedback.
-
Also, the file currently doesn't properly abide by the clang-format scheme: $ clang-format --dump-config | grep Standard
Standard: Latest But with the following diff: diff --git a/.clang-format b/.clang-format
index 34364d656..db47eb254 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,6 +1,6 @@
# please use clang-format version 8 or later
-Standard: Cpp11
+Standard: c++11
AccessModifierOffset: -8
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false $ clang-format --dump-config | grep Standard
Standard: c++11 This is just one example, there could be more but I haven't tested. |
Beta Was this translation helpful? Give feedback.
-
The comments in the .clang-format file date back to original explorations of using clang-format, and some of them were simply never re-evaluated after the availability of clang-format 7/8 on CI, which is where we enforce code formatting. Largely, the choice of what version of clang-format we use had to do with what was shipped with Visual Studio and also what was available on the CI runners at the time we switched to clang-format 13.0.1. clang-format 13.0.1 was the "easiest" to sync with at the time, and we have not revisited that since then, due in part to Ubuntu CI runners not updating their built-in versions of clang-format and wanting to avoid having to implement/maintain a solution to re-sync CI with more recent versions of Visual Studio. That said, I am keeping an eye on possible clang-format updates in upcoming versions of Visual Studio, and considering an update to the version of clang-format that we use. |
Beta Was this translation helpful? Give feedback.
-
Noticed while looking into obsproject/obs-plugintemplate#82 (comment).
The CI build script currently uses
clang-format
version13.0.*
:obs-studio/CI/check-format.sh
Lines 28 to 42 in 8789c43
But the
.clang-format
file has a comment saying to use version 8 or later, even though it's recommended by the devs to use the same version as the CI (so it doesn't fail formatting). Also, some lines are commented out because they require version 7, even thought version 8 (or 13) is the one to use.Beta Was this translation helpful? Give feedback.
All reactions