pocc / pre-commit-hooks

C/C++ hooks to integrate with pre-commit
Apache License 2.0
323 stars 67 forks source link

Add a check for a parser error in clang-tidy #26

Closed Lyle-Alloy closed 3 years ago

Lyle-Alloy commented 3 years ago

I spent a while debugging a problem that was just me putting in bad command line arguments (clang tidy accepts -p compile_commands.json, but args needs -p=compile_commands.json, that's a different problem though).

This change would just print the error from clang tidy verbatim if that happens.

iceslab commented 3 years ago

I wasted way too much time looking for a reason why clang-tidy hook fails. Finally I've found this pull request and changing args to -p=compile_commands.json did the job.

pocc commented 3 years ago

I've simplified the clang-tidy hook code so stderr should be passed correctly. Can you check whether this works for you?