diff --git a/.clang-format-ignore b/.clang-format-ignore index 4b7b414bb9..ae3fd2306b 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -1,3 +1,7 @@ -# exclude third party code from clang-format checks +# Exclude third party code from clang-format checks. +# +# This file is used by the clang-format-lint-action on Github. +# When updating this list, remember to update Jamulus.pro's CLANG_SOURCES +# as well. ./libs ./windows/nsProcess diff --git a/.github/workflows/coding-style-check.yml b/.github/workflows/coding-style-check.yml index 26ab8fadad..5e85c2d19d 100644 --- a/.github/workflows/coding-style-check.yml +++ b/.github/workflows/coding-style-check.yml @@ -17,4 +17,6 @@ jobs: - uses: DoozyX/clang-format-lint-action@2a28e3a8d9553f244243f7e1ff94f6685dff87be with: clangFormatVersion: 10 + # When updating the extension list, remember to update + # Jamulus.pro's CLANG_SOURCES as well. extensions: 'cpp,h' diff --git a/Jamulus.pro b/Jamulus.pro index 169c8a5b0c..3e595decfb 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -1169,3 +1169,10 @@ contains(CONFIG, "disable_version_check") { ANDROID_ABIS = armeabi-v7a arm64-v8a x86 x86_64 +# Enable formatting all code via `make clang_format`. +# Note: When extending the list of file extensions or when changing the excludes, +# be sure to update .github/workflows/coding-style-check.yml and .clang-format-ignore as well. +CLANG_SOURCES = $$files(*.cpp, true) $$files(*.h, true) +CLANG_SOURCES ~= s!^\(libs/|moc_|ui_|windows/nsProcess/|src/res/qrc_resources\.cpp\)\S*$!!g +clang_format.commands = 'clang-format -i $$CLANG_SOURCES' +QMAKE_EXTRA_TARGETS += clang_format