Fix cland tidy errors and other warning (#555)

This commit is contained in:
Boris Taševski 2022-09-15 15:51:35 +02:00 committed by GitHub
parent bb6cf35441
commit a0b8871b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 26 deletions

View File

@ -555,7 +555,7 @@ class List {
friend class Value;
friend class Record;
friend class Result;
friend struct Parameter;
friend class Parameter;
public:
/// @brief Creates a List from the copy of the given @ref mgp_list.
@ -653,7 +653,7 @@ class Map {
friend class Value;
friend class Record;
friend class Result;
friend struct Parameter;
friend class Parameter;
public:
/// @brief Creates a Map from the copy of the given @ref mgp_map.
@ -788,7 +788,7 @@ class Node {
friend class Value;
friend class Record;
friend class Result;
friend struct Parameter;
friend class Parameter;
/// @brief Creates a Node from the copy of the given @ref mgp_vertex.
explicit Node(mgp_vertex *ptr) : ptr_(mgp::vertex_copy(ptr, memory)) {}
@ -846,7 +846,7 @@ class Relationship {
friend class Value;
friend class Record;
friend class Result;
friend struct Parameter;
friend class Parameter;
public:
/// @brief Creates a Relationship from the copy of the given @ref mgp_edge.
@ -897,7 +897,7 @@ class Path {
friend class Value;
friend class Record;
friend class Result;
friend struct Parameter;
friend class Parameter;
public:
/// @brief Creates a Path from the copy of the given @ref mgp_path.
@ -949,7 +949,7 @@ class Date {
friend class Value;
friend class Record;
friend class Result;
friend struct Parameter;
friend class Parameter;
public:
/// @brief Creates a Date object from the copy of the given @ref mgp_date.
@ -1003,7 +1003,7 @@ class LocalTime {
friend class Value;
friend class Record;
friend class Result;
friend struct Parameter;
friend class Parameter;
public:
/// @brief Creates a LocalTime object from the copy of the given @ref mgp_local_time.
@ -1063,7 +1063,7 @@ class LocalDateTime {
friend class Value;
friend class Record;
friend class Result;
friend struct Parameter;
friend class Parameter;
public:
/// @brief Creates a LocalDateTime object from the copy of the given @ref mgp_local_date_time.
@ -1131,7 +1131,7 @@ class Duration {
friend class Value;
friend class Record;
friend class Result;
friend struct Parameter;
friend class Parameter;
public:
/// @brief Creates a Duration from the copy of the given @ref mgp_duration.
@ -2743,7 +2743,7 @@ void AddFunction(mgp_func_cb callback, std::string_view name, std::vector<mgp::P
mgp_module *module, mgp_memory *memory) {
auto func = mgp::module_add_function(module, name.data(), callback);
for (const auto parameter : parameters) {
for (const auto &parameter : parameters) {
auto parameter_name = parameter.name.data();
if (!parameter.optional) {

View File

@ -1734,10 +1734,12 @@ mgp_error mgp_vertex_add_label(struct mgp_vertex *v, mgp_label label) {
}
}
ctx->execution_stats[memgraph::query::ExecutionStats::Key::CREATED_LABELS] += 1;
if (ctx) {
ctx->execution_stats[memgraph::query::ExecutionStats::Key::CREATED_LABELS] += 1;
if (ctx->trigger_context_collector) {
ctx->trigger_context_collector->RegisterSetVertexLabel(v->getImpl(), label_id);
if (ctx->trigger_context_collector) {
ctx->trigger_context_collector->RegisterSetVertexLabel(v->getImpl(), label_id);
}
}
});
}
@ -1774,10 +1776,12 @@ mgp_error mgp_vertex_remove_label(struct mgp_vertex *v, mgp_label label) {
}
}
ctx->execution_stats[memgraph::query::ExecutionStats::Key::DELETED_LABELS] += 1;
if (ctx) {
ctx->execution_stats[memgraph::query::ExecutionStats::Key::DELETED_LABELS] += 1;
if (ctx->trigger_context_collector) {
ctx->trigger_context_collector->RegisterRemovedVertexLabel(v->getImpl(), label_id);
if (ctx->trigger_context_collector) {
ctx->trigger_context_collector->RegisterRemovedVertexLabel(v->getImpl(), label_id);
}
}
});
}

View File

@ -95,7 +95,7 @@ static memgraph::query::CypherQuery *AddIndexedMatches(int num_matches, const st
static auto CreateIndexedVertices(int index_count, int vertex_count, memgraph::storage::Storage *db) {
auto label = db->NameToLabel("label");
auto prop = db->NameToProperty("prop");
db->CreateIndex(label, prop);
[[maybe_unused]] auto _ = db->CreateIndex(label, prop);
auto dba = db->Access();
for (int vi = 0; vi < vertex_count; ++vi) {
for (int index = 0; index < index_count; ++index) {

View File

@ -3028,7 +3028,7 @@ TEST(QueryPlan, Distinct) {
TEST(QueryPlan, ScanAllByLabel) {
memgraph::storage::Storage db;
auto label = db.NameToLabel("label");
db.CreateIndex(label);
[[maybe_unused]] auto _ = db.CreateIndex(label);
auto storage_dba = db.Access();
memgraph::query::DbAccessor dba(&storage_dba);
// Add a vertex with a label and one without.
@ -3086,7 +3086,7 @@ TEST(QueryPlan, ScanAllByLabelProperty) {
}
ASSERT_FALSE(dba.Commit().HasError());
}
db.CreateIndex(label, prop);
[[maybe_unused]] auto _ = db.CreateIndex(label, prop);
auto storage_dba = db.Access();
memgraph::query::DbAccessor dba(&storage_dba);
@ -3180,7 +3180,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyEqualityNoError) {
ASSERT_TRUE(string_vertex.SetProperty(prop, memgraph::storage::PropertyValue("string")).HasValue());
ASSERT_FALSE(dba.Commit().HasError());
}
db.CreateIndex(label, prop);
[[maybe_unused]] auto _ = db.CreateIndex(label, prop);
auto storage_dba = db.Access();
memgraph::query::DbAccessor dba(&storage_dba);
@ -3217,7 +3217,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyValueError) {
}
ASSERT_FALSE(dba.Commit().HasError());
}
db.CreateIndex(label, prop);
[[maybe_unused]] auto _ = db.CreateIndex(label, prop);
auto storage_dba = db.Access();
memgraph::query::DbAccessor dba(&storage_dba);
@ -3248,7 +3248,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyRangeError) {
}
ASSERT_FALSE(dba.Commit().HasError());
}
db.CreateIndex(label, prop);
[[maybe_unused]] auto _ = db.CreateIndex(label, prop);
auto storage_dba = db.Access();
memgraph::query::DbAccessor dba(&storage_dba);
@ -3301,7 +3301,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyEqualNull) {
ASSERT_TRUE(vertex_with_prop.SetProperty(prop, memgraph::storage::PropertyValue(42)).HasValue());
ASSERT_FALSE(dba.Commit().HasError());
}
db.CreateIndex(label, prop);
[[maybe_unused]] auto _ = db.CreateIndex(label, prop);
auto storage_dba = db.Access();
memgraph::query::DbAccessor dba(&storage_dba);
@ -3336,7 +3336,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyRangeNull) {
ASSERT_TRUE(vertex_with_prop.SetProperty(prop, memgraph::storage::PropertyValue(42)).HasValue());
ASSERT_FALSE(dba.Commit().HasError());
}
db.CreateIndex(label, prop);
[[maybe_unused]] auto _ = db.CreateIndex(label, prop);
auto storage_dba = db.Access();
memgraph::query::DbAccessor dba(&storage_dba);
@ -3367,7 +3367,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyNoValueInIndexContinuation) {
ASSERT_TRUE(v.SetProperty(prop, memgraph::storage::PropertyValue(2)).HasValue());
ASSERT_FALSE(dba.Commit().HasError());
}
db.CreateIndex(label, prop);
[[maybe_unused]] auto _ = db.CreateIndex(label, prop);
auto storage_dba = db.Access();
memgraph::query::DbAccessor dba(&storage_dba);
@ -3409,7 +3409,7 @@ TEST(QueryPlan, ScanAllEqualsScanAllByLabelProperty) {
ASSERT_FALSE(dba.Commit().HasError());
}
db.CreateIndex(label, prop);
[[maybe_unused]] auto _ = db.CreateIndex(label, prop);
// Make sure there are `vertex_count` vertices
{