[ English | 简体中文 ]
This document describes how to use the clang-format tool for code style checking, including checking methods for scenarios with and without a default configuration file.
Different checking commands are executed depending on whether the .clang-format configuration file exists in the project.
Note: The openvela project uses clang-format 14 version for code style checking.
When a default code style configuration file .clang-format exists in the project:
clang-format -n <filepath> --Werror-n: Check only, do not modify files.--Werror: Treat formatting warnings as errors.
When a default code style configuration file does not exist in the project:
clang-format --style=WebKit -n <filepath> --Werror-n: Check only, do not modify files.--Werror: Treat formatting warnings as errors.--style=WebKit: Use WebKit predefined code style.