You get a const, you get a const, EVERYBODY GETS A CONST#16543
You get a const, you get a const, EVERYBODY GETS A CONST#16543
Conversation
Add clang-tidy to warn for future
There was a problem hiding this comment.
How foolproof are these checks? Were there false-positives that you had to correct manually?
Is this reliable enough we could think about adding run-clang-tidy to the chk_style job to enforce this.
There was a problem hiding this comment.
ZERO false positives in the ENTIRE codebase. ZERO.
There was a problem hiding this comment.
straight-up fixed it and recompiled and it was fine.
There was a problem hiding this comment.
Notice that the only reason why the compile is failing here is because of a warning, which is that NOW the compiler sees that something could be a for(const auto& stuff: ...) -- previously, it was copied but there was no const, so the compiler didn't know if it was changed or not and hence could not warn about this.
Step 1: Build with clang-tidy enabled via CMake
This integrates clang-tidy into the build — every .cpp compiled will also be checked. However, this does not apply fixes automatically.
Step 2: Apply fixes using run-clang-tidy
The better approach for auto-fixing the whole codebase is using run-clang-tidy (ships with clang-tidy) on the compile commands database:
Step 3
????
Step 4
Profit!