1

I am not using CMake and I could not figure out how to build the compile_commands.json file separately; so, I have created a custom script that runs clang tidy on files. In Linux, the command works without issues:

clang-tidy -header-filter=.* --p=file --quiet $ENGINE_FILES -- --std=c++20 \
        $SYSTEM_INCLUDES -isystem./engine/src -isystem./engine/rhi/core/include -isystem./platform/base/include

Now, I try to use the same mechanism using Windows + Powershell:

clang-tidy -header-filter=.* --p=file --quiet "engine/src/liquid/window/Window.cpp" -- --std=c++20 -isystem.\engine\src -isystem.\vendor\Debug\include -isystem.\platform\base\include

I get an error:

Error while processing C:\repos\liquid-engine\engine\src\liquid\window\Window.cpp.
error: unable to handle compilation, expected exactly one compiler job in '' [clang-diagnostic-error]

How can I pass the correct arguments to clang-tidy on Windows.

EDIT: Interestingly, the actual linting works. I purposefully added code that the linter would fail on and clang-tidy actually worked. However, if everything is successful, clang-tidy throws this error about compiler job.

Gasim
  • 7,615
  • 14
  • 64
  • 131
  • 1
    Unfortunately, a long-standing PowerShell bug, present up to at least PowerShell (Core) v7.3.6, causes `-`-prefixed arguments that also contain `.` to be broken into _two_ arguments. See the linked duplicate and [GitHub issue #6291](https://github.com/PowerShell/PowerShell/issues/6291) for details. – mklement0 Aug 02 '23 at 23:24
  • Thank you! I would have not know to even search for this since the error message was so obscure. – Gasim Aug 03 '23 at 21:00
  • 1
    Indeed, it's a tricky bug because it manifests differently for different CLIs. It sounds like it shouldn't be hard to fix, but it's been around for a long time. – mklement0 Aug 03 '23 at 21:03

0 Answers0