From 97a8dc6514db70112678c4f1972ee65a6ab0281d Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Fri, 10 Jan 2020 17:37:54 +0200 Subject: [PATCH] CI: Added PVS-Studio static analysis on the continuous-integration server. --- .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++++ docs/CHANGELOG.txt | 1 + imgui.cpp | 6 ++++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 265c400dd..856e29f58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -265,3 +265,38 @@ jobs: run: | source emsdk-master/emsdk_env.sh make -C examples/example_emscripten + + Static-Analysis: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: Install Dependencies + env: + PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }} + run: | + if [[ "$PVS_STUDIO_LICENSE" != "" ]]; + then + echo "$PVS_STUDIO_LICENSE" > pvs-studio.lic + wget -q https://files.viva64.com/etc/pubkey.txt + sudo apt-key add pubkey.txt + sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list + sudo apt-get update + sudo apt-get install -y pvs-studio + fi + + - name: PVS-Studio static analysis + run: | + if [[ ! -f pvs-studio.lic ]]; + then + echo "PVS Studio license is missing. No analysis will be performed." + echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license." + echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/" + exit 0 + fi + cd examples/example_null + pvs-studio-analyzer trace -- make EXTRA_WARNINGS=1 + pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log + plog-converter -a 'GA:1,2;OP:1' -t errorfile -w pvs-studio.log diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 2575da172..36d107320 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -77,6 +77,7 @@ Other Changes: - Backends: GLFW: Added support for the missing mouse cursors newly added in GLFW 3.4+. [@rokups] - Backends: SDL: Wayland: use SDL_GetMouseState (because there is no global mouse state available on Wayland). (#2800, #2802) [@NeroBurner] +- CI: Added PVS-Studio static analysis on the continuous-integration server. [@rokups] - Examples: Explicitly adding -DIMGUI_IMPL_OPENGL_LOADER_GL3W to Makefile to match linking settings (otherwise if another loader such as Glew is accessible, the OpenGL3 backend might automatically use it). (#2919, #2798) diff --git a/imgui.cpp b/imgui.cpp index f659123e7..ed6da44d2 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8363,7 +8363,8 @@ static void ImGui::NavUpdate() IM_ASSERT(child_window->ChildId != 0); FocusWindow(parent_window); SetNavID(child_window->ChildId, 0); - g.NavIdIsAlive = false; // -V1048: Reassigning with same value, we're being explicit here. + // Reassigning with same value, we're being explicit here. + g.NavIdIsAlive = false; // -V1048 if (g.NavDisableMouseHover) g.NavMousePosDirty = true; } @@ -8453,7 +8454,8 @@ static void ImGui::NavUpdate() { //IMGUI_DEBUG_LOG("[Nav] NavInitRequest from move, window \"%s\", layer=%d\n", g.NavWindow->Name, g.NavLayer); g.NavInitRequest = g.NavInitRequestFromMove = true; - g.NavInitResultId = 0; // -V1048: Reassigning with same value, we're being explicit here. + // Reassigning with same value, we're being explicit here. + g.NavInitResultId = 0; // -V1048 g.NavDisableHighlight = false; } NavUpdateAnyRequestFlag();