Skip to content

Commit

Permalink
Merge pull request #2258 from hoffie/make-clang_format-support
Browse files Browse the repository at this point in the history
Jamulus.pro: Implement `(n)make clang_format`
  • Loading branch information
hoffie committed Mar 4, 2022
2 parents b2cb4a2 + 835cb13 commit 51b8997
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .github/workflows/coding-style-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,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,mm'
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ If a feature or function can be achieved in another way by another system or met
- Space before and after `(` and `)`, except no space between `)` and `;`, and no space before an empty `()`.
- All bodies of `if`, `else`, `while`, `for`, etc., to be enclosed in braces `{` and `}`, on separate lines.

You can use your editor's or IDE's clang-format support to accomplish that.
On the command line, you can run `make clang_format` to do the same before committing.

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.

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.
Expand Down
9 changes: 9 additions & 0 deletions Jamulus.pro
Original file line number Diff line number Diff line change
Expand Up @@ -1173,3 +1173,12 @@ contains(CONFIG, "disable_version_check") {
message(The version check is disabled.)
DEFINES += DISABLE_VERSION_CHECK
}

# Enable formatting all code via `make clang_format`.
# Note: When extending the list of file extensions or when adding new code directories,
# be sure to update .github/workflows/coding-style-check.yml and .clang-format-ignore as well.
CLANG_FORMAT_SOURCES = $$files(*.cpp, true) $$files(*.mm, true) $$files(*.h, true)
CLANG_FORMAT_SOURCES = $$find(CLANG_FORMAT_SOURCES, ^\(android|ios|mac|linux|src|windows\)/)
CLANG_FORMAT_SOURCES ~= s!^\(windows/\(nsProcess|ASIOSDK2\)/|src/res/qrc_resources\.cpp\)\S*$!!g
clang_format.commands = 'clang-format -i $$CLANG_FORMAT_SOURCES'
QMAKE_EXTRA_TARGETS += clang_format

0 comments on commit 51b8997

Please sign in to comment.