Browse Source

CI: Added PVS-Studio static analysis on the continuous-integration server.

Rokas Kupstys 5 years ago
parent
commit
97a8dc6514
3 changed files with 40 additions and 2 deletions
  1. 35 0
      .github/workflows/build.yml
  2. 1 0
      docs/CHANGELOG.txt
  3. 4 2
      imgui.cpp

+ 35 - 0
.github/workflows/build.yml

@@ -265,3 +265,38 @@ jobs:
       run: |
       run: |
         source emsdk-master/emsdk_env.sh
         source emsdk-master/emsdk_env.sh
         make -C examples/example_emscripten
         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

+ 1 - 0
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: 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
 - Backends: SDL: Wayland: use SDL_GetMouseState (because there is no global mouse state available
   on Wayland). (#2800, #2802) [@NeroBurner]
   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
 - 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
   settings (otherwise if another loader such as Glew is accessible, the OpenGL3 backend might
   automatically use it). (#2919, #2798)
   automatically use it). (#2919, #2798)

+ 4 - 2
imgui.cpp

@@ -8363,7 +8363,8 @@ static void ImGui::NavUpdate()
             IM_ASSERT(child_window->ChildId != 0);
             IM_ASSERT(child_window->ChildId != 0);
             FocusWindow(parent_window);
             FocusWindow(parent_window);
             SetNavID(child_window->ChildId, 0);
             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)
             if (g.NavDisableMouseHover)
                 g.NavMousePosDirty = true;
                 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);
         //IMGUI_DEBUG_LOG("[Nav] NavInitRequest from move, window \"%s\", layer=%d\n", g.NavWindow->Name, g.NavLayer);
         g.NavInitRequest = g.NavInitRequestFromMove = true;
         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;
         g.NavDisableHighlight = false;
     }
     }
     NavUpdateAnyRequestFlag();
     NavUpdateAnyRequestFlag();