[SERVER-67134] Create new clang-tidy system with new checks enabled Created: 08/Jun/22  Updated: 29/Oct/23  Resolved: 30/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: New Feature Priority: Major - P3
Reporter: Alex Neben Assignee: Alex Neben
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-67651 Errors reported from the new clang-ti... Closed
Backwards Compatibility: Fully Compatible
Sprint: Dev Platform 2022-06-27, Dev Platform 2022-07-11
Participants:

 Comments   
Comment by Alex Neben [ 30/Jun/22 ]

https://github.com/10gen/mongo/pull/5979#issuecomment-1170732649

Comment by Githook User [ 30/Jun/22 ]

Author:

{'name': 'Alexander Neben', 'email': 'alexander.neben@mongodb.com', 'username': 'IamXander'}

Message: SERVER-67134 Added new evergreen job for new clang tidy checks
Branch: master
https://github.com/mongodb/mongo/commit/f19c83a01236c1a5fc4c7938281060de1a280a3c

Comment by Githook User [ 29/Jun/22 ]

Author:

{'name': 'Alexander Neben', 'email': 'alexander.neben@mongodb.com', 'username': 'IamXander'}

Message: SERVER-67134 mozjs debug mode fixes
Branch: master
https://github.com/mongodb/mongo/commit/effae311008134662042b9aafc0aa5a16c36e7ae

Comment by Githook User [ 23/Jun/22 ]

Author:

{'name': 'Alexander Neben', 'email': 'alexander.neben@mongodb.com', 'username': 'IamXander'}

Message: SERVER-67134 Fixed assert logging (bugprone-lambda-function-name)
Branch: davish/SERVER-63099
https://github.com/mongodb/mongo/commit/c798b60a95cbcf43145a5c31061b553ba86bd2e0

Comment by Githook User [ 23/Jun/22 ]

Author:

{'name': 'Alexander Neben', 'email': 'alexander.neben@mongodb.com', 'username': 'IamXander'}

Message: SERVER-67134 Fixed assert logging (bugprone-lambda-function-name)
Branch: master
https://github.com/mongodb/mongo/commit/c798b60a95cbcf43145a5c31061b553ba86bd2e0

Comment by Alex Neben [ 14/Jun/22 ]

New checks:
bugprone-*

boost-use-to-string

cert-err34-c - warn use of atoi vs strtol (the latter has error reporting)
cert-err52-cpp - do not use longjmp or setjmp
cert-err60-cpp - excpetion objects must be no-throw copy ctor
cert-flp30-c - do not use floating point values in for loops
cppcoreguidelines-*
fuchsia-virtual-inheritance
google-* (google-build-using-namespace - this will ban using namespace)
hicpp-*
llvm-include-order (https://llvm.org/docs/CodingStandards.html#include-style)
llvm-namespace-comment
misc-* (misc-unused-parameters - will force f(int i) -> f(int). Could mean lots of very small changes. However, on new code that this flags I think it usually means a typo)
modernize-*
performance-*
readability-* (readability-braces-around-statements seems to affect a lot of areas, readability-else-after-return is pretty opinionated, readability-named-parameter - this one might conflict with unused-parameters, readability-redundant-member-init - pretty opinionated)

-readability-identifier-naming - like function size this is super opinionated. I want to avoid this for now and revist when we can write out own rules.
-readability-function-size - I am not sure how we would want to use this. I also cannot be the only one deciding on what makes a function too complex.
-modernize-return-braced-init-list - I think this hurts readability
-modernize-redundant-void-arg - I think this hurts readability
-hicpp-no-assembler - lol we use inline assembly
-google-runtime-references - disallows non-cost references as function args
-google-readability-todo - todos should follow a specific format
-cppcoreguidelines-pro-type-vararg - warns about c stay va_args - I think these are use sparingly and mostly for printfs anyway
-cppcoreguidelines-pro-type-reinterpret-cast - warns about reinterpret_cast - I think there are legit uses of reinterpret_cast
-cppcoreguidelines-pro-type-const-cast - warns of using const_cast - I think this is a pretty well known anti-pattern so almost all cases of this will just be ignored 
-cppcoreguidelines-pro-bounds-array-to-pointer-decay - warns when decaying and array to pointer. I worry this will be really hard to fix. Not even sure that there is a better way to pass an array by reference. 
-cppcoreguidelines-owning-memory (requires gsl::owner<int*>) - superseded by using unique_ptr
-cppcoreguidelines-narrowing-conversions (int i = 0; i += 0.1 - I am worried this is going to flag a LOT of things and the false positive rate is going to be in the 90% range
-bugprone-throw-keyword-missing (based on having exception in the name)
-bugprone-virtual-near-miss (based on naming, this can be avoid by using the virtual, override, final paradigm)
-bugprone-easily-swappable-parameters - will flag things like abc(size_t x, size_t y). Seems useful in some cases but usually seems too strong. 

 

Generated at Thu Feb 08 06:07:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.