Unreal Engine Project Takes a Long Time to Scan

To essentially explain the issue here, I’ve got an Unreal Engine 5 project that I’m trying to scan with SonarCloud. So far I’ve succeeded in getting it to scan properly, but the scan takes an unacceptably long time to complete. The project has about 2.5k lines of C++ code, and only takes about 2 minutes to build. Meanwhile, the scan takes about 2 hours on average. I’ve never encountered this with a C++ project before, and I’m wondering what the cause might be here.

So my question is, has anyone worked with an Unreal Engine project before with either SonarCloud or SonarQube and managed to get it to scan in a more reasonable time, and if so, what exactly did you do to reduce the amount of time it takes to scan.

My first thought might be the include files, as Unreal Engine includes a lot of header files within their own headers, thus adding more code for SonarQube to process.

Template for a good new topic, formatted with Markdown:

  • ALM used: GitHub

  • CI system used: GitHub Actions (Self-Hosted Runner)

  • Scanner command used when applicable:
    & $env:SONAR_DIRECTORY/build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir bw-output “C:\Program Files\Epic Games\UE_5.3\Engine\Binaries\DotNet\UnrealBuildTool\UnrealBuildTool.exe” <Absolute path of .uproject file> UnrealEditor Win64 DebugGame
    & $env:SONAR_SCANNER_HOME/bin/sonar-scanner.bat --define sonar.cfamily.build-wrapper-output=bw-output -D sonar.host.url=https://sonarcloud.io -D sonar.cfamily.cobertura.reportPaths=coverage.xml

  • Unreal Engine C++/Python

  • URL: https://sonarcloud.io/project/overview?id=fcorso2016_unreal-pokemon

  • Steps to reproduce:

    • Create new Unreal Engine C++ project
    • Build project using the build wrapper on Windows
    • Perform scan, should take a long time
  • Potential workaround: None so far

Hey there.

Do you have a link to this repo (which I’m assuming is open source, since it’s a public SonarCloud project)?

This is the link. As I mentioned it’s an Unreal Engine project. As you can see the number of includes on the actual source files is fairly low, so I am assuming the engine code is the problem.

Thanks! And I’m realizing it might be an effort for us to get a real build of this up and running. Again since this is open source I hope it’s no problem – can you include your build wrapper output folder and the analysis logs at DEBUG level (sonar-scanner -X)?

Apologies for the delayed response. It turns out the thread limit was setting to the number of cores on my machine, which was essentially causing a resource choak. Right now it’s down to a much more respectable 15 minutes, but can balloon to 40 if I do something that touches every file in the project.

1 Like