Azure / azure-sdk-for-c

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

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

Open CIPop opened 2 years ago

CIPop commented 2 years ago

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 commented 2 years ago

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

CIPop commented 1 year ago

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

image

CIPop commented 1 year ago

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

rmknan commented 1 year ago

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?

danieljurek commented 1 year ago

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.