Azure / azure-sdk-for-cpp

This repository is for active development of the Azure SDK for C++. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-cpp.
MIT License
170 stars 118 forks source link

When clang-format fails in CI, it could print the diff #5666

Open antkmsft opened 1 month ago

antkmsft commented 1 month ago

I think we can make a simple fix to make it so that if the clang-format fails, it would not only list the files where it failed, but would also print the diff.

I would not propose this, if I thought it would be expensive to fix, but I think we might be able to get away with the git diff command.

An output like this could be helpful when clang-format behaves differently on the developer machine and the CI machine, also there could be differen versions, and different behavior on different platforms. It does not happen very often, but when it happens, it can drive you crazy. When this happen, I myself run the WSL, install clang-format there, clone the repo, and do clang-format there. It takes time. Sometimes, I would be happy to just copy several strings from the build logs, and be done with it.

When we have this, and it works, I think it can be cheaply ported to the Codegen repo, and to the Embedded C repo (I am not creating similar work items in those repositories for now).