From 3561e144d2078762d702b8451fc16633074324d9 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Fri, 20 Jun 2025 07:44:17 +0200 Subject: [PATCH 1/4] fix: check pipeline size before adjacent_find --- modules/core/task/include/task.hpp | 8 ++++++-- modules/core/task/tests/task_tests.cpp | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/modules/core/task/include/task.hpp b/modules/core/task/include/task.hpp index 8223878d..2ca28f15 100644 --- a/modules/core/task/include/task.hpp +++ b/modules/core/task/include/task.hpp @@ -246,12 +246,16 @@ class Task { bool was_worked_ = false; bool IsFullPipelineStage() { + if (functions_order_.size() < 4) { + return false; + } + auto it = std::adjacent_find(functions_order_.begin() + 2, functions_order_.begin() + static_cast(functions_order_.size() - 2), std::not_equal_to<>()); - return (functions_order_.size() >= 4 && functions_order_[0] == "Validation" && - functions_order_[1] == "PreProcessing" && functions_order_[2] == "Run" && + return (functions_order_[0] == "Validation" && functions_order_[1] == "PreProcessing" && + functions_order_[2] == "Run" && it == (functions_order_.begin() + static_cast(functions_order_.size() - 2)) && functions_order_[functions_order_.size() - 1] == "PostProcessing"); } diff --git a/modules/core/task/tests/task_tests.cpp b/modules/core/task/tests/task_tests.cpp index 6fc76455..a69cb289 100644 --- a/modules/core/task/tests/task_tests.cpp +++ b/modules/core/task/tests/task_tests.cpp @@ -153,6 +153,25 @@ TEST(task_tests, check_empty_order_disabled_valgrind) { EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*"); } +TEST_NOLINT(task_tests, premature_postprocessing_no_steps) { + auto destroy_function = [] { + std::vector in(20, 1); + ppc::test::task::TestTask, float> test_task(in); + ASSERT_NO_THROW(test_task.PostProcessing()); + }; + EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*"); +} + +TEST_NOLINT(task_tests, premature_postprocessing_after_preprocessing) { + auto destroy_function = [] { + std::vector in(20, 1); + ppc::test::task::TestTask, float> test_task(in); + ASSERT_NO_THROW(test_task.PreProcessing()); + ASSERT_NO_THROW(test_task.PostProcessing()); + }; + EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*"); +} + int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); From ee7e7a47e899b72fe448823a0e58d5bda4b60b24 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Fri, 20 Jun 2025 09:02:23 +0200 Subject: [PATCH 2/4] Add nolint --- modules/core/task/tests/task_tests.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/core/task/tests/task_tests.cpp b/modules/core/task/tests/task_tests.cpp index a69cb289..c9bee1e4 100644 --- a/modules/core/task/tests/task_tests.cpp +++ b/modules/core/task/tests/task_tests.cpp @@ -157,7 +157,7 @@ TEST_NOLINT(task_tests, premature_postprocessing_no_steps) { auto destroy_function = [] { std::vector in(20, 1); ppc::test::task::TestTask, float> test_task(in); - ASSERT_NO_THROW(test_task.PostProcessing()); + ASSERT_NO_THROW_NOLINT(test_task.PostProcessing()); }; EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*"); } @@ -166,8 +166,8 @@ TEST_NOLINT(task_tests, premature_postprocessing_after_preprocessing) { auto destroy_function = [] { std::vector in(20, 1); ppc::test::task::TestTask, float> test_task(in); - ASSERT_NO_THROW(test_task.PreProcessing()); - ASSERT_NO_THROW(test_task.PostProcessing()); + ASSERT_NO_THROW_NOLINT(test_task.PreProcessing()); + ASSERT_NO_THROW_NOLINT(test_task.PostProcessing()); }; EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*"); } From e1ead003b1462c5f8056e5a50350d320a27d2e69 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Sun, 22 Jun 2025 17:40:52 +0200 Subject: [PATCH 3/4] Remove NOLINTs --- modules/core/task/tests/task_tests.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/core/task/tests/task_tests.cpp b/modules/core/task/tests/task_tests.cpp index c9bee1e4..0b31ad42 100644 --- a/modules/core/task/tests/task_tests.cpp +++ b/modules/core/task/tests/task_tests.cpp @@ -153,21 +153,21 @@ TEST(task_tests, check_empty_order_disabled_valgrind) { EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*"); } -TEST_NOLINT(task_tests, premature_postprocessing_no_steps) { +TEST(task_tests, premature_postprocessing_no_steps) { auto destroy_function = [] { std::vector in(20, 1); ppc::test::task::TestTask, float> test_task(in); - ASSERT_NO_THROW_NOLINT(test_task.PostProcessing()); + ASSERT_NO_THROW(test_task.PostProcessing()); }; EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*"); } -TEST_NOLINT(task_tests, premature_postprocessing_after_preprocessing) { +TEST(task_tests, premature_postprocessing_after_preprocessing) { auto destroy_function = [] { std::vector in(20, 1); ppc::test::task::TestTask, float> test_task(in); - ASSERT_NO_THROW_NOLINT(test_task.PreProcessing()); - ASSERT_NO_THROW_NOLINT(test_task.PostProcessing()); + ASSERT_NO_THROW(test_task.PreProcessing()); + ASSERT_NO_THROW(test_task.PostProcessing()); }; EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*"); } From d808d6278c3d393c24b5aeb607f061d86e5c9999 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Sun, 22 Jun 2025 21:56:51 +0200 Subject: [PATCH 4/4] 100 --- modules/core/task/tests/.clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/task/tests/.clang-tidy b/modules/core/task/tests/.clang-tidy index 508219a9..ff87d986 100644 --- a/modules/core/task/tests/.clang-tidy +++ b/modules/core/task/tests/.clang-tidy @@ -38,4 +38,4 @@ Checks: > CheckOptions: - key: readability-function-cognitive-complexity.Threshold - value: 50 # default: 25 + value: 100 # default: 25