VS Static Analysis: How to ignore UE's files?

I’ve tried to use Visual Studio’s static analysis for my game project but it also checks the engine files, and when adding C++ Core Guidelines checks it takes a long time (it was over an hour and still didn’t complete).

Is there a way to have the analyzer ignore the engine files?

How I enabled Static Analysis:

  1. Added the following to AppData\Roaming\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml:

    <WindowsPlatform>
    <StaticAnalyzer>VisualCpp</StaticAnalyzer>
    
  2. I’ve rebuilt the UnrealBuildTool after adding Arguments.Add("/analyze:plugin EspXEngine.dll") to enable C++ Core Checks in Engine\Source\Programs\UnrealBuildTool\Platform\Windows\VCToolChain.cs.

The solution I used was to create the “caexcludepath” environment variable, and set it to the engine/Epic Games directory.

I also added the Intermediate directory of my project so as to exclude the .gen.cpp files as well. That bit is kind of a hack job but it works.