diff --git a/.clang-tidy b/.clang-tidy index 073ed33e09..431c498e9f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -7,6 +7,8 @@ Checks: > cppcoreguidelines-avoid-goto, cppcoreguidelines-avoid-non-const-global-variables, cppcoreguidelines-avoid-reference-coroutine-parameters, + cppcoreguidelines-interfaces-global-init, + cppcoreguidelines-rvalue-reference-param-not-moved, cppcoreguidelines-init-variables, cppcoreguidelines-prefer-member-initializer, cppcoreguidelines-special-member-functions diff --git a/include/cpp_common/path.hpp b/include/cpp_common/path.hpp index 879bd1da1d..65a0e5d91b 100644 --- a/include/cpp_common/path.hpp +++ b/include/cpp_common/path.hpp @@ -59,13 +59,13 @@ class Path { std::deque< Path_t > path; int64_t m_start_id; int64_t m_end_id; - double m_tot_cost; + double m_tot_cost{0}; public: - Path(): m_start_id(0), m_end_id(0), m_tot_cost(0) + Path() : m_start_id(0), m_end_id(0) {} Path(int64_t s_id, int64_t e_id) - : m_start_id(s_id), m_end_id(e_id), m_tot_cost(0) + : m_start_id(s_id), m_end_id(e_id) {} int64_t start_id() const {return m_start_id;} @@ -189,8 +189,7 @@ class Path { const Path &original, bool only_cost) : m_start_id(original.m_start_id), - m_end_id(original.m_end_id), - m_tot_cost(0) { + m_end_id(original.m_end_id) { if (original.path.empty()) return; typename G::EO_i ei, ei_end; diff --git a/src/max_flow/minCostMaxFlow.cpp b/src/max_flow/minCostMaxFlow.cpp index c4c30b0912..048a54dfc9 100644 --- a/src/max_flow/minCostMaxFlow.cpp +++ b/src/max_flow/minCostMaxFlow.cpp @@ -145,7 +145,7 @@ PgrCostFlowGraph::GetFlowEdges() const { if (((capacity[*e] - residual_capacity[*e]) > 0) && ((*e).m_source != supersource) && ((*e).m_target != supersink)) { - Flow_t edge; + Flow_t edge{}; edge.edge = GetEdgeId(*e); edge.source = GetVertexId((*e).m_source); edge.target = GetVertexId((*e).m_target);