Skip to content

Commit 51b8997

Browse files
authored
Merge pull request #2258 from hoffie/make-clang_format-support
Jamulus.pro: Implement `(n)make clang_format`
2 parents b2cb4a2 + 835cb13 commit 51b8997

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

.clang-format-ignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
# exclude third party code from clang-format checks
1+
# Exclude third party code from clang-format checks.
2+
#
3+
# This file is used by the clang-format-lint-action on Github.
4+
# When updating this list, remember to update Jamulus.pro's CLANG_SOURCES
5+
# as well.
26
./libs
37
./windows/nsProcess

.github/workflows/coding-style-check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ jobs:
1818
- uses: DoozyX/clang-format-lint-action@2a28e3a8d9553f244243f7e1ff94f6685dff87be
1919
with:
2020
clangFormatVersion: 10
21+
# When updating the extension list, remember to update
22+
# Jamulus.pro's CLANG_SOURCES as well.
2123
extensions: 'cpp,h,mm'

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ If a feature or function can be achieved in another way by another system or met
1919
- Space before and after `(` and `)`, except no space between `)` and `;`, and no space before an empty `()`.
2020
- All bodies of `if`, `else`, `while`, `for`, etc., to be enclosed in braces `{` and `}`, on separate lines.
2121

22+
You can use your editor's or IDE's clang-format support to accomplish that.
23+
On the command line, you can run `make clang_format` to do the same before committing.
24+
2225
Do not use diff/patch to send your code changes but create a Github fork of the Jamulus code and create a Pull Request when you are done.
2326

2427
Please run a local build test. Make sure there are no errors. After opening a pull request, keep an eye on the CI checks for quality or compile issues and fix them as required.

Jamulus.pro

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,3 +1173,12 @@ contains(CONFIG, "disable_version_check") {
11731173
message(The version check is disabled.)
11741174
DEFINES += DISABLE_VERSION_CHECK
11751175
}
1176+
1177+
# Enable formatting all code via `make clang_format`.
1178+
# Note: When extending the list of file extensions or when adding new code directories,
1179+
# be sure to update .github/workflows/coding-style-check.yml and .clang-format-ignore as well.
1180+
CLANG_FORMAT_SOURCES = $$files(*.cpp, true) $$files(*.mm, true) $$files(*.h, true)
1181+
CLANG_FORMAT_SOURCES = $$find(CLANG_FORMAT_SOURCES, ^\(android|ios|mac|linux|src|windows\)/)
1182+
CLANG_FORMAT_SOURCES ~= s!^\(windows/\(nsProcess|ASIOSDK2\)/|src/res/qrc_resources\.cpp\)\S*$!!g
1183+
clang_format.commands = 'clang-format -i $$CLANG_FORMAT_SOURCES'
1184+
QMAKE_EXTRA_TARGETS += clang_format

0 commit comments

Comments
 (0)