Configure clang-tidy job on CI (#6261)

This commit is contained in:
Siarhei Fedartsou
2022-06-28 01:14:28 +02:00
committed by GitHub
parent 79d4363d59
commit 59953172e8
22 changed files with 138 additions and 13 deletions
@@ -892,6 +892,7 @@ CoordinateExtractor::PrepareLengthCache(const std::vector<util::Coordinate> &coo
segment_distances.reserve(coordinates.size());
segment_distances.push_back(0);
// sentinel
// NOLINTNEXTLINE(bugprone-unused-return-value)
std::find_if(std::next(std::begin(coordinates)),
std::end(coordinates),
[last_coordinate = coordinates.front(),
@@ -884,6 +884,7 @@ void Sol2ScriptingEnvironment::ProcessElements(
case osmium::item_type::node:
{
const auto &node = static_cast<const osmium::Node &>(*entity);
// NOLINTNEXTLINE(bugprone-use-after-move)
result_node.clear();
if (local_context.has_node_function &&
(!node.tags().empty() || local_context.properties.call_tagless_node_function))
@@ -896,6 +897,7 @@ void Sol2ScriptingEnvironment::ProcessElements(
case osmium::item_type::way:
{
const osmium::Way &way = static_cast<const osmium::Way &>(*entity);
// NOLINTNEXTLINE(bugprone-use-after-move)
result_way.clear();
if (local_context.has_way_function)
{
+3
View File
@@ -15,6 +15,9 @@ message(STATUS "Configuring node_osrm bindings for NodeJs ${NODEJS_VERSION}")
add_nodejs_module(node_osrm node_osrm.cpp)
set_target_properties(node_osrm PROPERTIES CXX_STANDARD 14)
# TODO: we disable clang-tidy for this target, because it causes errors in third-party NodeJs related headers
set_target_properties(node_osrm PROPERTIES CXX_CLANG_TIDY "")
target_link_libraries(node_osrm osrm)
# node_osrm artifacts in ${BINDING_DIR} to depend targets on
+1 -1
View File
@@ -47,7 +47,7 @@ OSRM::OSRM(engine::EngineConfig &config)
engine_ = std::make_unique<engine::Engine<MLD>>(config);
break;
default:
util::exception("Algorithm not implemented!");
throw util::exception("Algorithm not implemented!");
}
}
OSRM::~OSRM() = default;
+4
View File
@@ -112,6 +112,7 @@ void checkWeightsConsistency(
if (geometry_id.forward)
{
auto range = segment_data.GetForwardWeights(geometry_id.id);
// NOLINTNEXTLINE(bugprone-fold-init-type)
EdgeWeight weight = std::accumulate(range.begin(), range.end(), EdgeWeight{0});
if (weight > edge.data.weight)
{
@@ -122,6 +123,7 @@ void checkWeightsConsistency(
else
{
auto range = segment_data.GetReverseWeights(geometry_id.id);
// NOLINTNEXTLINE(bugprone-fold-init-type)
EdgeWeight weight = std::accumulate(range.begin(), range.end(), EdgeWeight{0});
if (weight > edge.data.weight)
{
@@ -689,6 +691,7 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
new_weight += weight;
}
const auto durations = segment_data.GetForwardDurations(geometry_id.id);
// NOLINTNEXTLINE(bugprone-fold-init-type)
new_duration = std::accumulate(durations.begin(), durations.end(), EdgeWeight{0});
}
else
@@ -704,6 +707,7 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
new_weight += weight;
}
const auto durations = segment_data.GetReverseDurations(geometry_id.id);
// NOLINTNEXTLINE(bugprone-fold-init-type)
new_duration = std::accumulate(durations.begin(), durations.end(), EdgeWeight{0});
}
return std::make_tuple(new_weight, new_duration);
+1 -1
View File
@@ -386,7 +386,7 @@ double findClosestDistance(const std::vector<Coordinate> &lhs, const std::vector
std::min(current_min, findClosestDistance(coordinate, rhs.begin(), rhs.end()));
return false;
};
// NOLINTNEXTLINE(bugprone-unused-return-value)
std::find_if(std::begin(lhs), std::end(lhs), compute_minimum_distance_in_rhs);
return current_min;
}