Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/osrm-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

format-taginfo-docs:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.10
steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand All @@ -111,7 +111,7 @@ jobs:
- name: Prepare environment
run: |
npm ci --ignore-scripts
clang-format-15 --version
clang-format-19 --version
- name: Run checks
run: |
./scripts/check_taginfo.py taginfo.json profiles/car.lua
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased
- Changes from 6.0.0
- Misc:
- CHANGED: Upgrade from clang-format-15 to clang-format-19 [#7249](https://github.com/Project-OSRM/osrm-backend/issues/7249)
- ADDED: Add husky pre-commit hook for compiling and linting staged JS files [#7228](https://github.com/Project-OSRM/osrm-backend/issues/7228)
- CHANGED: Standardize linting configuration with ESM-specific rules [#7229](https://github.com/Project-OSRM/osrm-backend/issues/7229)
- CHANGED: Convert scripts from CommonJS to modern ESM format [#7230](https://github.com/Project-OSRM/osrm-backend/pull/7230)
Expand Down
11 changes: 5 additions & 6 deletions include/contractor/contract_excludable_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
// Add all non-core edges to container
{
auto non_core_edges = toEdges<QueryEdge>(contractor_graph);
auto new_end = std::remove_if(non_core_edges.begin(),
non_core_edges.end(),
[&](const auto &edge) {
return is_shared_core[edge.source] &&
is_shared_core[edge.target];
});
auto new_end = std::remove_if(
non_core_edges.begin(),
non_core_edges.end(),
[&](const auto &edge)
{ return is_shared_core[edge.source] && is_shared_core[edge.target]; });
non_core_edges.resize(new_end - non_core_edges.begin());
edge_container.Insert(std::move(non_core_edges));

Expand Down
4 changes: 2 additions & 2 deletions include/contractor/query_edge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ struct QueryEdge
struct EdgeData
{
explicit EdgeData()
: turn_id(0), shortcut(false), weight{0}, duration(0), forward(false),
backward(false), distance{0}
: turn_id(0), shortcut(false), weight{0}, duration(0), forward(false), backward(false),
distance{0}
{
}

Expand Down
16 changes: 8 additions & 8 deletions include/engine/api/base_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class BaseAPI
util::json::Object MakeWaypoint(const PhantomNodeCandidates &candidates) const
{
// TODO: check forward/reverse
const auto toName = [this](const auto &phantom) {
const auto toName = [this](const auto &phantom)
{
return std::string(
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)));
};
Expand All @@ -67,9 +68,8 @@ class BaseAPI
std::transform(candidates.begin(),
candidates.end(),
seg_hints.begin(),
[this](const auto &phantom) {
return SegmentHint{phantom, facade.GetCheckSum()};
});
[this](const auto &phantom)
{ return SegmentHint{phantom, facade.GetCheckSum()}; });

return json::makeWaypoint(
snapped_location,
Expand Down Expand Up @@ -115,7 +115,8 @@ class BaseAPI
static_cast<float>(static_cast<double>(util::toFloating(snapped_location.lon))),
static_cast<float>(static_cast<double>(util::toFloating(snapped_location.lat))));

const auto toName = [this](const auto &phantom) {
const auto toName = [this](const auto &phantom)
{
return std::string(
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)));
};
Expand All @@ -135,9 +136,8 @@ class BaseAPI
std::transform(candidates.begin(),
candidates.end(),
seg_hints.begin(),
[this](const auto &phantom) {
return SegmentHint{phantom, facade.GetCheckSum()};
});
[this](const auto &phantom)
{ return SegmentHint{phantom, facade.GetCheckSum()}; });
Hint hint{std::move(seg_hints)};
hint_string = builder->CreateString(hint.ToBase64());
}
Expand Down
5 changes: 2 additions & 3 deletions include/engine/api/match_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ struct MatchParameters : public RouteParameters
bool tidy_,
const std::vector<std::size_t> &waypoints_,
Args &&...args_)
: RouteParameters{std::forward<Args>(args_)..., waypoints_}, timestamps{std::move(
timestamps_)},
gaps(gaps_), tidy(tidy_)
: RouteParameters{std::forward<Args>(args_)..., waypoints_},
timestamps{std::move(timestamps_)}, gaps(gaps_), tidy(tidy_)
{
}

Expand Down
12 changes: 6 additions & 6 deletions include/engine/api/route_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ struct RouteParameters : public BaseParameters
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
geometries{geometries_}, overview{overview_},
continue_straight{continue_straight_}, waypoints{std::move(waypoints_)}
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_},
waypoints{std::move(waypoints_)}
{
}

Expand All @@ -157,10 +157,10 @@ struct RouteParameters : public BaseParameters
std::vector<std::size_t> waypoints_,
Args &&...args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_ !=
AnnotationsType::None},
annotations_type{annotations_}, geometries{geometries_}, overview{overview_},
continue_straight{continue_straight_}, waypoints{std::move(waypoints_)}
number_of_alternatives{alternatives_ ? 1u : 0u},
annotations{annotations_ != AnnotationsType::None}, annotations_type{annotations_},
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_},
waypoints{std::move(waypoints_)}
{
}

Expand Down
4 changes: 2 additions & 2 deletions include/engine/api/trip_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ struct TripParameters : public RouteParameters
DestinationType destination_,
bool roundtrip_,
Args &&...args_)
: RouteParameters{std::forward<Args>(args_)...}, source{source_},
destination{destination_}, roundtrip{roundtrip_}
: RouteParameters{std::forward<Args>(args_)...}, source{source_}, destination{destination_},
roundtrip{roundtrip_}
{
}

Expand Down
9 changes: 4 additions & 5 deletions include/engine/phantom_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,15 @@ namespace osrm::engine
struct PhantomNode
{
PhantomNode()
: forward_segment_id{SPECIAL_SEGMENTID, false}, reverse_segment_id{SPECIAL_SEGMENTID,
false},
forward_weight(INVALID_EDGE_WEIGHT),
: forward_segment_id{SPECIAL_SEGMENTID, false},
reverse_segment_id{SPECIAL_SEGMENTID, false}, forward_weight(INVALID_EDGE_WEIGHT),
reverse_weight(INVALID_EDGE_WEIGHT), forward_weight_offset{0}, reverse_weight_offset{0},
forward_distance(INVALID_EDGE_DISTANCE), reverse_distance(INVALID_EDGE_DISTANCE),
forward_distance_offset{0}, reverse_distance_offset{0},
forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION),
forward_duration_offset{0}, reverse_duration_offset{0},
component({INVALID_COMPONENTID, 0}),
fwd_segment_position(0), is_valid_forward_source{false}, is_valid_forward_target{false},
component({INVALID_COMPONENTID, 0}), fwd_segment_position(0),
is_valid_forward_source{false}, is_valid_forward_target{false},
is_valid_reverse_source{false}, is_valid_reverse_target{false}, bearing(0)

{
Expand Down
2 changes: 1 addition & 1 deletion include/engine/plugins/plugin_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class BasePlugin
std::string message;

ErrorRenderer(std::string code, std::string message)
: code(std::move(code)), message(std::move(message)){};
: code(std::move(code)), message(std::move(message)) {};

void operator()(util::json::Object &json_result)
{
Expand Down
2 changes: 1 addition & 1 deletion include/engine/routing_algorithms/many_to_many.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct NodeBucket
{
unsigned column_idx;

ColumnCompare(unsigned column_idx) : column_idx(column_idx){};
ColumnCompare(unsigned column_idx) : column_idx(column_idx) {};

bool operator()(const NodeBucket &lhs, const NodeID &rhs) const // lowerbound
{
Expand Down
13 changes: 6 additions & 7 deletions include/engine/routing_algorithms/routing_base_mld.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ inline LevelID getNodeQueryLevel(const MultiLevelPartition &partition,
std::accumulate(endpoint_candidates.target_phantoms.begin(),
endpoint_candidates.target_phantoms.end(),
level_1,
[&](LevelID level_2, const PhantomNode &target) {
[&](LevelID level_2, const PhantomNode &target)
{
return std::min(
level_2,
getNodeQueryLevel(partition, node, source, target));
Expand Down Expand Up @@ -312,7 +313,7 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
const auto &cell =
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
auto destination = cell.GetDestinationNodes().begin();
auto distance = [&cell, node = heapNode.node ]() -> auto
auto distance = [&cell, node = heapNode.node]() -> auto
{
if constexpr (IS_MAP_MATCHING)
{
Expand All @@ -324,8 +325,7 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
boost::ignore_unused(cell, node);
return 0;
}
}
();
}();
for (auto shortcut_weight : cell.GetOutWeight(heapNode.node))
{
BOOST_ASSERT(destination != cell.GetDestinationNodes().end());
Expand Down Expand Up @@ -360,7 +360,7 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
const auto &cell =
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
auto source = cell.GetSourceNodes().begin();
auto distance = [&cell, node = heapNode.node ]() -> auto
auto distance = [&cell, node = heapNode.node]() -> auto
{
if constexpr (IS_MAP_MATCHING)
{
Expand All @@ -372,8 +372,7 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
boost::ignore_unused(cell, node);
return 0;
}
}
();
}();
for (auto shortcut_weight : cell.GetInWeight(heapNode.node))
{
BOOST_ASSERT(source != cell.GetSourceNodes().end());
Expand Down
5 changes: 2 additions & 3 deletions include/extractor/edge_based_node_segment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ namespace osrm::extractor
struct EdgeBasedNodeSegment
{
EdgeBasedNodeSegment()
: forward_segment_id{SPECIAL_SEGMENTID, false}, reverse_segment_id{SPECIAL_SEGMENTID,
false},
u(SPECIAL_NODEID), v(SPECIAL_NODEID),
: forward_segment_id{SPECIAL_SEGMENTID, false},
reverse_segment_id{SPECIAL_SEGMENTID, false}, u(SPECIAL_NODEID), v(SPECIAL_NODEID),
fwd_segment_position(std::numeric_limits<unsigned short>::max() >>
1), // >> 1 because we've only got 15 bits
is_startpoint(false)
Expand Down
4 changes: 1 addition & 3 deletions include/partitioner/bisection_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ std::vector<BisectionInputEdge> adaptToBisectionEdge(std::vector<InputEdge> edge
std::transform(begin(edges),
end(edges),
std::back_inserter(result),
[](const auto &edge) {
return BisectionInputEdge{edge.source, edge.target};
});
[](const auto &edge) { return BisectionInputEdge{edge.source, edge.target}; });

return result;
}
Expand Down
12 changes: 6 additions & 6 deletions include/partitioner/cell_storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ template <storage::Ownership Ownership> class CellStorageImpl
const NodeID *const all_sources,
const NodeID *const all_destinations)
: num_source_nodes{data.num_source_nodes},
num_destination_nodes{data.num_destination_nodes}, weights{all_weights +
data.value_offset},
durations{all_durations + data.value_offset}, distances{all_distances +
data.value_offset},
num_destination_nodes{data.num_destination_nodes},
weights{all_weights + data.value_offset},
durations{all_durations + data.value_offset},
distances{all_distances + data.value_offset},
source_boundary{all_sources + data.source_boundary_offset},
destination_boundary{all_destinations + data.destination_boundary_offset}
{
Expand All @@ -208,8 +208,8 @@ template <storage::Ownership Ownership> class CellStorageImpl
const NodeID *const all_destinations)
: num_source_nodes{data.num_source_nodes},
num_destination_nodes{data.num_destination_nodes}, weights{nullptr},
durations{nullptr}, distances{nullptr}, source_boundary{all_sources +
data.source_boundary_offset},
durations{nullptr}, distances{nullptr},
source_boundary{all_sources + data.source_boundary_offset},
destination_boundary{all_destinations + data.destination_boundary_offset}
{
BOOST_ASSERT(num_source_nodes == 0 || all_sources != nullptr);
Expand Down
46 changes: 23 additions & 23 deletions include/partitioner/edge_based_graph_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,29 +163,29 @@ graphToEdges(const DynamicEdgeBasedGraph &edge_based_graph)
[](const NodeID lhs, const NodeID rhs) { return std::max(lhs, rhs); });

std::vector<extractor::EdgeBasedEdge> edges(max_turn_id + 1);
tbb::parallel_for(
range,
[&](const auto range)
{
for (auto node = range.begin(); node < range.end(); ++node)
{
for (auto edge : edge_based_graph.GetAdjacentEdgeRange(node))
{
const auto &data = edge_based_graph.GetEdgeData(edge);
// we only need to save the forward edges, since the read method
// will convert from forward to bi-directional edges again
if (data.forward)
{
auto target = edge_based_graph.GetTarget(edge);
BOOST_ASSERT(data.turn_id <= max_turn_id);
edges[data.turn_id] = extractor::EdgeBasedEdge{node, target, data};
// only save the forward edge
edges[data.turn_id].data.forward = true;
edges[data.turn_id].data.backward = false;
}
}
}
});
tbb::parallel_for(range,
[&](const auto range)
{
for (auto node = range.begin(); node < range.end(); ++node)
{
for (auto edge : edge_based_graph.GetAdjacentEdgeRange(node))
{
const auto &data = edge_based_graph.GetEdgeData(edge);
// we only need to save the forward edges, since the read method
// will convert from forward to bi-directional edges again
if (data.forward)
{
auto target = edge_based_graph.GetTarget(edge);
BOOST_ASSERT(data.turn_id <= max_turn_id);
edges[data.turn_id] =
extractor::EdgeBasedEdge{node, target, data};
// only save the forward edge
edges[data.turn_id].data.forward = true;
edges[data.turn_id].data.backward = false;
}
}
}
});

return edges;
}
Expand Down
3 changes: 2 additions & 1 deletion include/partitioner/multi_level_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
{
iter = std::find_if(iter,
edge_and_level_end,
[node, level](const auto &edge_and_level) {
[node, level](const auto &edge_and_level)
{
return boost::get<0>(edge_and_level).source != node ||
boost::get<1>(edge_and_level) != level;
});
Expand Down
14 changes: 7 additions & 7 deletions include/partitioner/remove_unconnected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ std::size_t removeUnconnectedBoundaryNodes(const GraphT &edge_based_graph,
auto new_end =
std::remove_if(witnesses.begin(),
witnesses.end(),
[&](const auto &witness) {
[&](const auto &witness)
{
return partitions[level_index + 1][node] !=
partitions[level_index + 1][witness.id];
});
Expand All @@ -89,12 +90,11 @@ std::size_t removeUnconnectedBoundaryNodes(const GraphT &edge_based_graph,
}
}

auto best_witness =
std::min_element(witnesses.begin(),
witnesses.end(),
[](const auto &lhs, const auto &rhs) {
return lhs.induced_border_edges < rhs.induced_border_edges;
});
auto best_witness = std::min_element(
witnesses.begin(),
witnesses.end(),
[](const auto &lhs, const auto &rhs)
{ return lhs.induced_border_edges < rhs.induced_border_edges; });
BOOST_ASSERT(best_witness != witnesses.end());

// assign `node` to same subcells as `best_witness`
Expand Down
Loading
Loading