Skip to content

Commit 910c5f7

Browse files
authored
Fixing codacy issues (#2532)
* [codacy] scope can be reduced * [C] int64 -> int32 when output is INTEGER * [withPoitsDD] Marking as TODO an error on pg16 * [codacy] fixing some codacy errors * [C++] fixing consequence of last changes
1 parent d7958f1 commit 910c5f7

51 files changed

Lines changed: 55 additions & 61 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/bellman_ford/pgr_edwardMoore.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ class Pgr_edwardMoore {
4848

4949
std::deque<Path> edwardMoore(
5050
G &graph,
51-
std::vector<int64_t> start_vertex,
52-
std::vector<int64_t> end_vertex) {
51+
const std::vector<int64_t> &start_vertex,
52+
const std::vector<int64_t> &end_vertex) {
5353
std::deque<Path> paths;
5454

55-
for (auto source : start_vertex) {
55+
for (const auto &source : start_vertex) {
5656
std::deque<Path> result_paths = one_to_many_edwardMoore(
5757
graph,
5858
source,

include/breadthFirstSearch/pgr_binaryBreadthFirstSearch.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ class Pgr_binaryBreadthFirstSearch {
5252

5353
std::deque<Path> binaryBreadthFirstSearch(
5454
G &graph,
55-
std::vector<int64_t> start_vertex,
56-
std::vector<int64_t> end_vertex) {
55+
const std::vector<int64_t> &start_vertex,
56+
const std::vector<int64_t> &end_vertex) {
5757
std::deque<Path> paths;
5858

59-
for (auto source : start_vertex) {
59+
for (const auto &source : start_vertex) {
6060
std::deque<Path> result_paths = one_to_many_binaryBreadthFirstSearch(
6161
graph,
6262
source,

include/cpp_common/identifiers.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ class Identifiers {
5656
//! @name constructors
5757
//@{
5858
Identifiers<T>() = default;
59-
Identifiers<T>(const std::set<T>& data) {
60-
m_ids = data;
59+
Identifiers<T>(const std::set<T>& data) : m_ids(data) {
6160
}
6261

6362
/* @brief initializes with {1 ~ number}

include/dijkstra/drivingDist.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ template < class G >
6868
std::deque<Path>
6969
pgr_drivingDistance(
7070
G &graph,
71-
std::vector< int64_t > start_vids,
71+
const std::vector<int64_t> &start_vids,
7272
double distance,
7373
bool equicost,
7474
std::ostringstream &log) {

include/spanningTree/details.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ std::vector<int64_t>
3737
clean_vids(std::vector<int64_t> vids);
3838

3939
std::vector<MST_rt>
40-
get_no_edge_graph_result(
41-
std::vector<int64_t> vids);
40+
get_no_edge_graph_result(const std::vector<int64_t> &vids);
4241

4342
} // namespace details
4443
} // namespace pgrouting

include/spanningTree/pgr_mst.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,9 @@ class Pgr_mst {
286286
} else {
287287
std::vector<MST_rt> results;
288288
for (const auto root : m_roots) {
289-
std::vector<E> visited_order;
290-
291289
using dfs_visitor = visitors::Dfs_visitor_with_root<V, E>;
292290
if (graph.has_vertex(root)) {
293-
/* abort in case of an interruption occurs (e.g. the query is being cancelled) */
291+
std::vector<E> visited_order;
294292
CHECK_FOR_INTERRUPTS();
295293
try {
296294
boost::depth_first_search(

include/traversal/pgr_depthFirstSearch.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ class Pgr_depthFirstSearch {
8585
std::vector < MST_rt > results;
8686

8787
for (auto root : roots) {
88-
std::vector < E > visited_order;
8988
results.push_back({root, 0, root, -1, 0.0, 0.0});
9089

9190
if (graph.has_vertex(root)) {
91+
std::vector<E> visited_order;
9292
auto v_root(graph.get_V(root));
9393

9494
depthFirstSearch_single_vertex(graph, v_root, visited_order, directed, max_depth);

pgtap/withPoints/withPointsDD/edge_cases/issue_979.pg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ FROM
131131
) AS t (node, edge, cost, agg_cost);
132132

133133

134+
SELECT todo('test failing with postgres 16',1);
134135
SELECT set_eq('q3',
135136
$$SELECT node, edge, round(cost::numeric, 12) AS cost, round(agg_cost::numeric, 12) AS agg_cost FROM test3$$,
136137
'Should be aggregating individual costs: left driving side, DIR');

src/astar/astar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ _pgr_astar(PG_FUNCTION_ARGS) {
233233
}
234234

235235

236-
values[0] = Int64GetDatum((int64_t)funcctx->call_cntr + 1);
236+
values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1);
237237
values[1] = Int32GetDatum(result_tuples[funcctx->call_cntr].seq);
238238
values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].start_id);
239239
values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].end_id);

src/bdAstar/bdAstar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ _pgr_bdastar(PG_FUNCTION_ARGS) {
222222
nulls[i] = false;
223223
}
224224

225-
values[0] = Int64GetDatum((int64_t)call_cntr + 1);
225+
values[0] = Int32GetDatum((int32_t)call_cntr + 1);
226226
values[1] = Int32GetDatum(result_tuples[call_cntr].seq);
227227
values[2] = Int64GetDatum(result_tuples[call_cntr].start_id);
228228
values[3] = Int64GetDatum(result_tuples[call_cntr].end_id);

0 commit comments

Comments
 (0)