PragmaTwice opened a new issue, #1029: URL: https://github.com/apache/incubator-kvrocks/issues/1029
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/incubator-kvrocks/issues) and found no similar issues. ### Motivation ``` clang-analyzer-core.CallAndMessage clang-analyzer-core.CallAndMessageModeling clang-analyzer-core.DivideZero clang-analyzer-core.DynamicTypePropagation clang-analyzer-core.NonNullParamChecker clang-analyzer-core.NonnilStringConstants clang-analyzer-core.NullDereference clang-analyzer-core.StackAddrEscapeBase clang-analyzer-core.StackAddressEscape clang-analyzer-core.UndefinedBinaryOperatorResult clang-analyzer-core.VLASize clang-analyzer-core.builtin.BuiltinFunctions clang-analyzer-core.builtin.NoReturnFunctions clang-analyzer-core.uninitialized.ArraySubscript clang-analyzer-core.uninitialized.Assign clang-analyzer-core.uninitialized.Branch clang-analyzer-core.uninitialized.CapturedBlockVariable clang-analyzer-core.uninitialized.UndefReturn clang-analyzer-cplusplus.InnerPointer clang-analyzer-cplusplus.Move clang-analyzer-cplusplus.NewDelete clang-analyzer-cplusplus.NewDeleteLeaks clang-analyzer-cplusplus.PlacementNew clang-analyzer-cplusplus.PureVirtualCall clang-analyzer-cplusplus.SelfAssignment clang-analyzer-cplusplus.SmartPtrModeling clang-analyzer-cplusplus.VirtualCallModeling clang-analyzer-deadcode.DeadStores clang-analyzer-nullability.NullPassedToNonnull clang-analyzer-nullability.NullReturnedFromNonnull clang-analyzer-nullability.NullabilityBase clang-analyzer-nullability.NullableDereferenced clang-analyzer-nullability.NullablePassedToNonnull clang-analyzer-nullability.NullableReturnedFromNonnull clang-analyzer-security.FloatLoopCounter clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling clang-analyzer-security.insecureAPI.SecuritySyntaxChecker clang-analyzer-security.insecureAPI.UncheckedReturn clang-analyzer-security.insecureAPI.bcmp clang-analyzer-security.insecureAPI.bcopy clang-analyzer-security.insecureAPI.bzero clang-analyzer-security.insecureAPI.decodeValueOfObjCType clang-analyzer-security.insecureAPI.getpw clang-analyzer-security.insecureAPI.gets clang-analyzer-security.insecureAPI.mkstemp clang-analyzer-security.insecureAPI.mktemp clang-analyzer-security.insecureAPI.rand clang-analyzer-security.insecureAPI.strcpy clang-analyzer-security.insecureAPI.vfork clang-analyzer-unix.API clang-analyzer-unix.DynamicMemoryModeling clang-analyzer-unix.Malloc clang-analyzer-unix.MallocSizeof clang-analyzer-unix.MismatchedDeallocator clang-analyzer-unix.Vfork clang-analyzer-unix.cstring.BadSizeArg clang-analyzer-unix.cstring.CStringModeling clang-analyzer-unix.cstring.NullArg clang-analyzer-valist.CopyToSelf clang-analyzer-valist.Uninitialized clang-analyzer-valist.Unterminated clang-analyzer-valist.ValistBase cppcoreguidelines-init-variables 229 cppcoreguidelines-interfaces-global-init 0 cppcoreguidelines-macro-usage 41 cppcoreguidelines-narrowing-conversions 145 cppcoreguidelines-no-malloc 0 cppcoreguidelines-prefer-member-initializer 24 cppcoreguidelines-slicing 0 cppcoreguidelines-special-member-functions 3 google-build-explicit-make-pair 0 google-default-arguments 0 google-explicit-constructor 0 modernize-avoid-bind 3 modernize-loop-convert 12 modernize-make-shared 2 modernize-make-unique 2 modernize-pass-by-value 4 modernize-redundant-void-arg 17 modernize-return-braced-init-list 3 modernize-use-auto 11 modernize-use-bool-literals 16 modernize-use-emplace 0 modernize-use-equals-default 0 modernize-use-equals-delete 0 modernize-use-nullptr 5 modernize-use-override 1 modernize-use-using 1 performance-faster-string-find 5 performance-for-range-copy 5 performance-implicit-conversion-in-loop 0 performance-inefficient-algorithm 0 performance-inefficient-vector-operation 6 performance-move-const-arg 2 performance-move-constructor-init 0 performance-no-automatic-move 0 performance-trivially-destructible 0 performance-type-promotion-in-math-fn 0 performance-unnecessary-copy-initialization 0 performance-unnecessary-value-param 29 ``` Currently we have enabled lots of clang-tidy checks, but there are so many reports in current kvrocks code, so we cannot treat these report as errors to block future PR with some clang-tidy reported warnings. We can solve these report and enable warning-as-error: https://github.com/apache/incubator-kvrocks/actions/runs/3306051644/jobs/5456650165#step:8:898 For example: ``` /home/runner/work/incubator-kvrocks/incubator-kvrocks/src/cluster/redis_slot.cc:72:29: warning: 'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character [performance-faster-string-find] auto right_pos = key.find("}", left_pos + 1); ^~~ '}' ``` For this report (categorized as `performance-faster-string-find`), we can replace "}" with '}', and submit a patch. If all `performance-faster-string-find` tagged report are solved within this patch, we can add `performance-faster-string-find` to `WarningsAsErrors` in `.clang-tidy`. Then, if `performance-faster-string-find` tagged report appears in a future PR, the CI will fail. ### Solution _No response_ ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
