azure-sdk-for-c icon indicating copy to clipboard operation
azure-sdk-for-c copied to clipboard

CLang-Format version (clang-format-9 does not exist in Ubuntu 22)

Open CIPop opened this issue 2 years ago • 5 comments

CI Fails with CLang format running version 9:

clang-format version 9.0.0-2~ubuntu18.04.2 (tags/RELEASE_900/final) 

 M sdk/tests/iot/hub/test_az_iot_hub_client_properties.c 

Some files were not formatted correctly according to the .clang-format file. 

Please run clang-format to fix the issue by using this bash command at the root of the repo: 

find . \( -iname '*.h' -o -iname '*.c' \) -exec clang-format -i {} \;

On my Ubuntu 20.04, clang-format has version 10.0.0-4ubuntu1 and it has slightly different format.

This is to track:

  1. Documentation is updated to specify what version of CLang to use.
  2. The bash script should specify the CLang version

CIPop avatar Apr 08 '22 22:04 CIPop

Feature branch attempt: https://github.com/Azure/azure-sdk-for-c/pull/2178/files

CIPop avatar Apr 08 '22 22:04 CIPop

Clang-format-9 does not exist in Ubuntu 22. It's probably best to change the formatter to a newer version.

image

CIPop avatar Aug 21 '23 16:08 CIPop

For reference, installing from the llvm package repositories might be a viable workaround (that I have not tested): https://stackoverflow.com/questions/20756924/how-can-i-install-clang-format-in-ubuntu

CIPop avatar Aug 21 '23 16:08 CIPop

For reference, installing from the llvm package repositories might be a viable workaround (that I have not tested): https://stackoverflow.com/questions/20756924/how-can-i-install-clang-format-in-ubuntu

Yeah, I tried doing that but even when I get the repositories from the llvm , clang-format-9 does not come...It starts from clang 11.

On the other hand, I have a .gz file that has clang-format-9 in it. I tried pasting it in the root directory but it does not seem to recognize it from there, do you know how to proceed with that?

rmknan avatar Aug 21 '23 20:08 rmknan

Go ahead and move the clang formatter up to the version that's most right for you in archetype-sdk-client.yml. Some files may be altered when running clang-format so the process would be (includes links to engsys stuff):

  1. Update clang-format in archetype-sdk-client.yml (include installation config here)
  2. Run clang-format on locally using the expected version
  3. Review and commit source changes and archetype-sdk-client.yml changes
  4. Push and open PR, ensure that clang-format --version is outputting the expected versions

The pipeline should pass and you'll probably be good to merge.

danieljurek avatar Aug 21 '23 20:08 danieljurek