Skip to content

Commit

Permalink
[#197]: Fix SA issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Apr 21, 2024
1 parent bee08b6 commit 9ba9cbb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-modernize-use-trailing-return-type,-llvm*,-hicpp-uppercase-literal-suffix, -readability-uppercase-literal-suffix, -readability-implicit-bool-conversion,-cppcoreguidelines-avoid-magic-numbers, -readability-magic-numbers, -cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-bounds-pointer-arithmetic, -cppcoreguidelines-pro-type-reinterpret-cast-cppcoreguidelines-pro-type-vararg, -cppcoreguidelines-pro-type-vararg, -hicpp-vararg, -altera-id-dependent-backward-branch, -bugprone-easily-swappable-parameters, -readability-identifier-length, -altera-unroll-loops, -cppcoreguidelines-non-private-member-variables-in-classes, -altera-struct-pack-align, -misc-non-private-member-variables-in-classes, -cppcoreguidelines-pro-type-static-cast-downcast, -readability-convert-member-functions-to-static, -cppcoreguidelines-owning-memory,
-hicpp-signed-bitwise, -readability-redundant-access-specifiers, -readability-avoid-const-params-in-decls,
-cppcoreguidelines-avoid-non-const-global-variables, -readability-function-cognitive-complexity'
-cppcoreguidelines-avoid-non-const-global-variables, -readability-function-cognitive-complexity, -misc-include-cleaner'
WarningsAsErrors: '*'
HeaderFilterRegex: ''
FormatStyle: none
2 changes: 1 addition & 1 deletion .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
source \$root_dir/vulkan/1.3.216.0/setup-env.sh" > init_script.sh
- name: Run static analysis
uses: JacobDomagala/StaticAnalysis@master
uses: JacobDomagala/StaticAnalysis@116-update-tools
with:
cmake_args: -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
exclude_dir: vulkan
Expand Down
2 changes: 1 addition & 1 deletion editor/gui/editor_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ EditorGUI::EditGroup(const std::string& oldName)
if (ImGui::Button("Rename", {ImGui::GetWindowWidth() / 3.0f, 35}))
{
renameGroupPushed_ = false;
auto& objects = groups_.at(oldName);
const auto& objects = groups_.at(oldName);
for (auto obj : objects)
{
objectsInfo_.at(obj).groupName = newName;
Expand Down
18 changes: 9 additions & 9 deletions editor/gui/editor_gui_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,13 @@ EditorGUI::RenderLevelMenu() // NOLINT
// The second parameter is the label previewed before opening the combo.
if (ImGui::BeginCombo("##filterByGroup", selectedGroup.c_str()))
{
for (const auto& group : groupNames_)
auto selected = std::find_if(groupNames_.begin() + 1, groupNames_.end(),
[](const auto& group) { return ImGui::Selectable(group.c_str()); });
if (selected != groupNames_.end())
{
if (ImGui::Selectable(group.c_str()))
{
selectedGroup = group;
break;
}
selectedGroup = *selected;
}

ImGui::EndCombo();
}
});
Expand Down Expand Up @@ -424,15 +423,16 @@ EditorGUI::RenderLevelMenu() // NOLINT
ImGui::TableSetupColumn("GroupName", ImGuiTableColumnFlags_WidthStretch, 0.90f * totalWidth);
ImGui::TableSetupColumn("EditGroup", ImGuiTableColumnFlags_WidthStretch, 0.10f * totalWidth);

// NOLINTNEXTLINE
static std::string groupNameToEdit = "";

for (uint32_t idx = 1; idx < groupNames_.size(); ++idx)
{
CreateActionRow(
[this, idx] {
const auto& groupName = groupNames_.at(idx);
bool selected = selectedGroup_ == groupName;

if (ImGui::Selectable(groupName.c_str(), selected))
if (ImGui::Selectable(groupName.c_str(), selectedGroup_ == groupName))
{
parent_.UnselectAll();
selectedGroup_ = groupName;
Expand All @@ -448,7 +448,7 @@ EditorGUI::RenderLevelMenu() // NOLINT
}
},
[this, idx] {
if (ImGui::Button(std::format("{} ##ChangeGroupButton{}", ICON_FA_PENCIL, idx).c_str()))
if (ImGui::Button(fmt::format("{} ##ChangeGroupButton{}", ICON_FA_PENCIL, idx).c_str()))
{
groupNameToEdit = groupNames_.at(idx);
renameGroupPushed_ = true;
Expand Down

0 comments on commit 9ba9cbb

Please sign in to comment.