From a46b001de1aa28ccf671ba44660a8ab07dcc6f1e Mon Sep 17 00:00:00 2001 From: Mag1str02 Date: Fri, 22 Nov 2024 12:32:01 +0300 Subject: [PATCH] Fixed tidy errors --- .github/workflows/main.yml | 2 +- CMake/Compiler.cmake | 2 +- DummyEditor/CMakeLists.txt | 3 +++ DummyEditor/ImGuiUtils/ImGuiManager.cpp | 2 +- DummyEditor/Panels/InspectorPanel.cpp | 4 ++-- DummyEditor/Panels/ViewportPanel.cpp | 15 ++++++++------- DummyEditor/Panels/ViewportPanel.h | 12 ++++++------ DummyEngine/Utils/DS/Trie.hpp | 2 +- 8 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5698117..4d903ca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -107,7 +107,7 @@ jobs: files-changed-only: false database: '${{ github.workspace }}/build' repo-root: '${{ github.workspace }}' - ignore: 'build/**|Examples/**|Sandbox/**|DummyEngine/Core/ECS**|DummyEngine/Platform/Macos/**|DummyEditor/Platform/Macos/**' + ignore: 'build/**|Examples/**|Sandbox/**|DummyEngine/Core/ECS**|DummyEngine/Platform/**|DummyEditor/Platform/**' step-summary: true - name: Check Linter Results if: steps.linter.outputs.checks-failed > 0 diff --git a/CMake/Compiler.cmake b/CMake/Compiler.cmake index a4bfe9b..49f858f 100644 --- a/CMake/Compiler.cmake +++ b/CMake/Compiler.cmake @@ -17,7 +17,7 @@ if(${DE_ENABLE_CLANG_TIDY_ON_COMPILATION}) find_program(CLANG_TIDY_EXE NAMES "clang-tidy" "clang-tidy-17" "clang-tidy-18" "clang-tidy-19" REQUIRED) set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "-p" "${CMAKE_CURRENT_SOURCE_DIR}/build") if (${DE_CLANG_TIDY_WARNINGS_AS_ERRORS}) - set(CLANG_TIDY_COMMAND ${CLANG_TIDY_COMMAND} "--warnings-as-errors='*'") + set(CLANG_TIDY_COMMAND ${CLANG_TIDY_COMMAND} "--warnings-as-errors=*") endif() message(STATUS "CLANG_TIDY_COMMAND: [${CLANG_TIDY_COMMAND}]") endif() diff --git a/DummyEditor/CMakeLists.txt b/DummyEditor/CMakeLists.txt index 720cb78..b2a40d1 100644 --- a/DummyEditor/CMakeLists.txt +++ b/DummyEditor/CMakeLists.txt @@ -15,4 +15,7 @@ add_dependencies(DummyEditor DummyEditorScripts) if (${ENABLE_PRECOMPILED_HEADERS}) target_precompile_headers(DummyEditor REUSE_FROM DummyEngineLib) +endif() +if (${DE_ENABLE_CLANG_TIDY_ON_COMPILATION}) + set_target_properties(DummyEditor PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}") endif() \ No newline at end of file diff --git a/DummyEditor/ImGuiUtils/ImGuiManager.cpp b/DummyEditor/ImGuiUtils/ImGuiManager.cpp index 6e394ce..fd3d09e 100644 --- a/DummyEditor/ImGuiUtils/ImGuiManager.cpp +++ b/DummyEditor/ImGuiUtils/ImGuiManager.cpp @@ -52,7 +52,7 @@ namespace DummyEngine { ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::Begin("DockSpace", - NULL, + nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus | ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking); diff --git a/DummyEditor/Panels/InspectorPanel.cpp b/DummyEditor/Panels/InspectorPanel.cpp index 297b2df..816c1f4 100644 --- a/DummyEditor/Panels/InspectorPanel.cpp +++ b/DummyEditor/Panels/InspectorPanel.cpp @@ -22,10 +22,10 @@ namespace DummyEngine { case ScriptFieldType::Float: return ImGuiDataType_Float; case ScriptFieldType::S32: return ImGuiDataType_S32; case ScriptFieldType::U32: return ImGuiDataType_U32; - case ScriptFieldType::S64: return ImGuiDataType_S64; + case ScriptFieldType::S64: return ImGuiDataType_S64; case ScriptFieldType::U64: return ImGuiDataType_U64; default: return ImGuiDataType_COUNT; - } + } } template void InspectorPanel::DrawComponentWidget() { diff --git a/DummyEditor/Panels/ViewportPanel.cpp b/DummyEditor/Panels/ViewportPanel.cpp index 64d4971..f3b131b 100644 --- a/DummyEditor/Panels/ViewportPanel.cpp +++ b/DummyEditor/Panels/ViewportPanel.cpp @@ -12,13 +12,14 @@ namespace DummyEngine { if (m_Controller) { ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); if (ImGui::Begin((ICON_MD_TV + m_Name).c_str())) { - m_ViewportSize = ImGui::GetContentRegionAvail(); - auto buffer = m_FrameBuffer.lock(); + viewport_size_ = ImGui::GetContentRegionAvail(); + auto buffer = frame_buffer_.lock(); if (buffer) { - if (m_UseDepthAttachment) { - ImGui::Image(buffer->GetDepthAttachment()->GetRendererId(), m_ViewportSize, {0, 1}, {1, 0}); + if (use_depth_attachment_) { + ImGui::Image(buffer->GetDepthAttachment()->GetRendererId(), viewport_size_, {0, 1}, {1, 0}); } else { - ImGui::Image(buffer->GetColorAttachment(0)->GetRendererId(), m_ViewportSize, {0, 1}, {1, 0}); + ImGui::Image(buffer->GetColorAttachment(0)->GetRendererId(), viewport_size_, {0, 1}, {1, 0}); + ToolPanel(); } } @@ -69,7 +70,7 @@ namespace DummyEngine { ++button_amount; build_and_run = true; } - ImVec2 cursor_pos{m_ViewportSize.x * 0.5f - (button_amount * button_size.x + (button_amount - 1) * button_padding.x) / 2, button_padding.y}; + ImVec2 cursor_pos{viewport_size_.x * 0.5f - (button_amount * button_size.x + (button_amount - 1) * button_padding.x) / 2, button_padding.y}; if (play) { ImGui::SetCursorPos(cursor_pos); @@ -119,6 +120,6 @@ namespace DummyEngine { } } void ViewportPanel::SetFrameBuffer(Ref buffer) { - m_FrameBuffer = buffer; + frame_buffer_ = buffer; } } // namespace DummyEngine \ No newline at end of file diff --git a/DummyEditor/Panels/ViewportPanel.h b/DummyEditor/Panels/ViewportPanel.h index 5a089ec..76a0758 100644 --- a/DummyEditor/Panels/ViewportPanel.h +++ b/DummyEditor/Panels/ViewportPanel.h @@ -18,14 +18,14 @@ namespace DummyEngine { void ToolPanel(); void SetFrameBuffer(Ref buffer); - U32 GetWidth() const { return m_ViewportSize.x; } - U32 GetHeight() const { return m_ViewportSize.y; } - void UseDepthAttachment(bool f) { m_UseDepthAttachment = f; } + U32 GetWidth() const { return viewport_size_.x; } + U32 GetHeight() const { return viewport_size_.y; } + void UseDepthAttachment(bool f) { use_depth_attachment_ = f; } private: - bool m_UseDepthAttachment = false; - ImVec2 m_ViewportSize; - WeakRef m_FrameBuffer; + bool use_depth_attachment_ = false; + ImVec2 viewport_size_; + WeakRef frame_buffer_; }; } // namespace DummyEngine \ No newline at end of file diff --git a/DummyEngine/Utils/DS/Trie.hpp b/DummyEngine/Utils/DS/Trie.hpp index 352974b..47c6af3 100644 --- a/DummyEngine/Utils/DS/Trie.hpp +++ b/DummyEngine/Utils/DS/Trie.hpp @@ -7,7 +7,7 @@ namespace DummyEngine { class Trie { struct Node { Node(Ref& p, char prev) { - Parent = p; + Parent = p; CharToParent = prev; }