diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..120a401 --- /dev/null +++ b/.clang-format @@ -0,0 +1,43 @@ +--- +BasedOnStyle: Google +IndentWidth: 4 +--- +Language: Cpp +ColumnLimit: 180 +BreakArrays: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BraceWrapping: + AfterFunction: true + AfterEnum: false + AfterStruct: false + SplitEmptyFunction: false +SortIncludes: true +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^"sdkconfig.h"' + Priority: 10 + - Regex: '^"freertos/.*\.h"' + Priority: 10 + SortPriority: 11 + - Regex: '^"esp_.*\.h"' + Priority: 10 + SortPriority: 12 + - Regex: '^"driver/.*\.h"' + Priority: 10 + SortPriority: 13 + - Regex: '^"(nvs|adc|nvs_flash|cJSON|hal/.*|soc/.*|rom/.*).h"' + Priority: 10 + SortPriority: 13 + - Regex: '.*' + Priority: 20 +AlignOperands: true +AlignConsecutiveMacros: Consecutive +AllowShortFunctionsOnASingleLine: false +AllowShortEnumsOnASingleLine: false +BinPackArguments: false +BinPackParameters: false +SeparateDefinitionBlocks: Always +IndentCaseLabels: false \ No newline at end of file diff --git a/.clang-format-ignore b/.clang-format-ignore new file mode 100644 index 0000000..afcbe88 --- /dev/null +++ b/.clang-format-ignore @@ -0,0 +1 @@ +components/*/lib/**/* \ No newline at end of file diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml index 87e21dc..34b4a22 100644 --- a/.github/workflows/builder.yml +++ b/.github/workflows/builder.yml @@ -16,6 +16,18 @@ on: - created jobs: + formatting-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run clang-format style check + uses: jidicula/clang-format-action@v4.13.0 + with: + clang-format-version: '18' + build: runs-on: ubuntu-latest