Skip to content

Jamulus.pro: Implement (n)make clang_format #2258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1171,3 +1171,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