3

I use clang-format to format my source code and I want to verify the coding style(variable name préfix, indentation, ...) in gitlab CI.

I already use code quality to check variable scop.

I want to add coding style verify in code quality.

someone know how to do that ?

ps: I am not a gitllab CI specialist.

Tom Penard
  • 141
  • 8

1 Answers1

2

I have found this solution, add fallowing lines to .gitlab-ci.yml:

format:
  stage: test
  image: nexus.lumiplan.com:8443/toolchain/clang-format:13
  needs: []
  script:
    - find rootToYourProject \( \( -name \*.cpp -o -name \*.h \) -a ! -iname \*soap\* \) -print0 | xargs -0 -n 1 clang-format-13 --Werror -n --verbose
  only:
    - merge_requests

With this script I do a verification of my clang format configuration to all .cpp and .h files excepted for soap files.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Tom Penard
  • 141
  • 8