szaszm commented on code in PR #1330:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1330#discussion_r871831718


##########
thirdparty/rapidjson-48fbd8cd202ca54031fe799db2ad44ffa8e77c13/include/rapidjson/document.h:
##########
@@ -1236,7 +1236,7 @@ class GenericValue {
 
             // Use static buffer and placement-new to prevent destruction
             static char buffer[sizeof(GenericValue)];
-            return *new (buffer) GenericValue();
+            return *new (buffer) GenericValue();  // 
NOLINT(clang-analyzer-cplusplus.PlacementNew)

Review Comment:
   Can we exclude the thirdparty directory instead?



##########
libminifi/test/unit/SocketTests.cpp:
##########
@@ -190,7 +190,7 @@ TEST_CASE("TestTLSContextCreation", "[TestSocket8]") {
     std::function<bool()> f_ex = createSocket;
     utils::Worker<bool> functor(f_ex, "id");
     std::future<bool> fut;
-    pool.execute(std::move(functor), fut);
+    pool.execute(std::move(functor), fut);  // NOLINT(bugprone-use-after-move)

Review Comment:
   What kind of use-after-move is happening here? This looks perfectly valid to 
me, not reusing anything after move.



##########
.clang-tidy:
##########
@@ -0,0 +1,2 @@
+Checks: 
'boost*,bugprone*,cert*,portability*,-clang-analyzer-optin.cplusplus.VirtualCall,-bugprone-narrowing-conversions,-bugprone-implicit-widening-of-multiplication-result,-bugprone-macro-parentheses,-bugprone-easily-swappable-parameters,-bugprone-exception-escape,-cert-err58-cpp,-cert-err33-c'

Review Comment:
   A few of the disabled ones make sense IMO. This is the list I'm using with 
CLion:
   ```
   -*
   bugprone-argument-comment
   bugprone-assert-side-effect
   bugprone-bad-signal-to-kill-thread
   bugprone-branch-clone
   bugprone-copy-constructor-init
   bugprone-dangling-handle
   bugprone-dynamic-static-initializers
   bugprone-fold-init-type
   bugprone-forward-declaration-namespace
   bugprone-forwarding-reference-overload
   bugprone-inaccurate-erase
   bugprone-incorrect-roundings
   bugprone-integer-division
   bugprone-lambda-function-name
   bugprone-macro-parentheses
   bugprone-macro-repeated-side-effects
   bugprone-misplaced-operator-in-strlen-in-alloc
   bugprone-misplaced-pointer-arithmetic-in-alloc
   bugprone-misplaced-widening-cast
   bugprone-move-forwarding-reference
   bugprone-multiple-statement-macro
   bugprone-no-escape
   bugprone-not-null-terminated-result
   bugprone-parent-virtual-call
   bugprone-posix-return
   bugprone-reserved-identifier
   bugprone-sizeof-container
   bugprone-sizeof-expression
   bugprone-spuriously-wake-up-functions
   bugprone-string-constructor
   bugprone-string-integer-assignment
   bugprone-string-literal-with-embedded-nul
   bugprone-suspicious-enum-usage
   bugprone-suspicious-include
   bugprone-suspicious-memory-comparison
   bugprone-suspicious-memset-usage
   bugprone-suspicious-missing-comma
   bugprone-suspicious-semicolon
   bugprone-suspicious-string-compare
   bugprone-swapped-arguments
   bugprone-terminating-continue
   bugprone-throw-keyword-missing
   bugprone-too-small-loop-variable
   bugprone-undefined-memory-manipulation
   bugprone-undelegated-constructor
   bugprone-unhandled-self-assignment
   bugprone-unused-raii
   bugprone-unused-return-value
   bugprone-use-after-move
   bugprone-virtual-near-miss
   cert-dcl21-cpp
   cert-dcl58-cpp
   cert-err34-c
   cert-err52-cpp
   cert-err58-cpp
   cert-err60-cpp
   cert-flp30-c
   cert-msc50-cpp
   cert-msc51-cpp
   cert-str34-c
   cppcoreguidelines-interfaces-global-init
   cppcoreguidelines-narrowing-conversions
   cppcoreguidelines-pro-type-member-init
   cppcoreguidelines-pro-type-static-cast-downcast
   cppcoreguidelines-slicing
   google-default-arguments
   google-explicit-constructor
   google-runtime-operator
   hicpp-exception-baseclass
   hicpp-multiway-paths-covered
   misc-misplaced-const
   misc-new-delete-overloads
   misc-no-recursion
   misc-non-copyable-objects
   misc-throw-by-value-catch-by-reference
   misc-unconventional-assign-operator
   misc-uniqueptr-reset-release
   modernize-avoid-bind
   modernize-concat-nested-namespaces
   modernize-deprecated-headers
   modernize-deprecated-ios-base-aliases
   modernize-loop-convert
   modernize-make-shared
   modernize-make-unique
   modernize-pass-by-value
   modernize-raw-string-literal
   modernize-redundant-void-arg
   modernize-replace-auto-ptr
   modernize-replace-disallow-copy-and-assign-macro
   modernize-replace-random-shuffle
   modernize-return-braced-init-list
   modernize-shrink-to-fit
   modernize-unary-static-assert
   modernize-use-auto
   modernize-use-bool-literals
   modernize-use-emplace
   modernize-use-equals-default
   modernize-use-equals-delete
   modernize-use-nodiscard
   modernize-use-noexcept
   modernize-use-nullptr
   modernize-use-override
   modernize-use-transparent-functors
   modernize-use-uncaught-exceptions
   mpi-buffer-deref
   mpi-type-mismatch
   openmp-use-default-none
   performance-faster-string-find
   performance-for-range-copy
   performance-implicit-conversion-in-loop
   performance-inefficient-algorithm
   performance-inefficient-string-concatenation
   performance-inefficient-vector-operation
   performance-move-const-arg
   performance-move-constructor-init
   performance-no-automatic-move
   performance-noexcept-move-constructor
   performance-trivially-destructible
   performance-type-promotion-in-math-fn
   performance-unnecessary-copy-initialization
   performance-unnecessary-value-param
   portability-simd-intrinsics
   readability-avoid-const-params-in-decls
   readability-const-return-type
   readability-container-size-empty
   readability-convert-member-functions-to-static
   readability-delete-null-pointer
   readability-deleted-default
   readability-inconsistent-declaration-parameter-name
   readability-make-member-function-const
   readability-misleading-indentation
   readability-misplaced-array-index
   readability-non-const-parameter
   readability-redundant-control-flow
   readability-redundant-declaration
   readability-redundant-function-ptr-dereference
   readability-redundant-smartptr-get
   readability-redundant-string-cstr
   readability-redundant-string-init
   readability-simplify-subscript-expr
   readability-static-accessed-through-instance
   readability-static-definition-in-anonymous-namespace
   readability-string-compare
   readability-uniqueptr-delete-release
   readability-use-anyofallof
   ```



##########
extensions/openwsman/processors/SourceInitiatedSubscriptionListener.cpp:
##########
@@ -887,7 +887,7 @@ void SourceInitiatedSubscriptionListener::onSchedule(const 
std::shared_ptr<core:
 }
 
 void SourceInitiatedSubscriptionListener::notifyStop() {
-  server_.release();
+  server_.release();  // NOLINT(bugprone-unused-return-value)

Review Comment:
   Isn't this a real bug? I think it should be reset, not release.



##########
extensions/procfs/CpuStat.h:
##########
@@ -34,7 +34,12 @@ class CpuStatData {
  public:
   static std::optional<CpuStatData> parseCpuStatLine(std::istream& iss);
 
-  auto operator<=>(const CpuStatData& rhs) const = default;
+  bool operator<=(const CpuStatData& rhs) const;
+  bool operator>(const CpuStatData& rhs) const;
+  bool operator>=(const CpuStatData& rhs) const;
+  bool operator<(const CpuStatData& rhs) const;
+  bool operator==(const CpuStatData& rhs) const;
+  bool operator!=(const CpuStatData& rhs) const;

Review Comment:
   Why this over the spaceship operator?



##########
libminifi/src/controllers/SSLContextService.cpp:
##########
@@ -213,7 +213,8 @@ bool 
SSLContextService::addP12CertificateToSSLContext(SSL_CTX* ctx) const {
       core::logging::LOG_ERROR(logger_) << "Failed to set additional 
certificate from " << certificate_ << ", " << getLatestOpenSSLErrorString();
       return false;
     }
-    cacert.release();  // a successful SSL_CTX_add_extra_chain_cert() takes 
ownership of cacert
+    // a successful SSL_CTX_add_extra_chain_cert() takes ownership of cacert
+    cacert.release();  // NOLINT(bugprone-unused-return-value)

Review Comment:
   Would casting the expression to void hide the warning? It might be an 
alternative to NOLINT.



-- 
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]

Reply via email to