1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Add clang-format file

People should run `make format` before doing a commit.
Fix https://github.com/profanity-im/profanity/issues/1396
This commit is contained in:
Michael Vetter 2020-07-07 09:42:00 +02:00
parent 87ddb8081e
commit 66f9a6b721
3 changed files with 48 additions and 0 deletions

33
.clang-format Normal file
View File

@ -0,0 +1,33 @@
Language: Cpp
BasedOnStyle: GNU
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeParens: ControlStatements
ColumnLimit: 0
PointerAlignment: Left
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowShortBlocksOnASingleLine: true
IndentWidth: 4
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterControlStatement: Never
AfterFunction: true
BeforeElse: false
#BeforeWhile: false
AfterStruct: true
#BreakStringLiterals: true

View File

@ -3,6 +3,11 @@
## Coding style
Follow the style already present ;-)
To make this easier for you we created a `.clang-format` file.
You'll need to have `clang-format` installed.
Then just run `make format` before you do any commit.
## Pull Requests
Before submitting a Pull Request please run valgrind and the clang static code analyzer.

View File

@ -237,6 +237,13 @@ core_sources += $(omemo_sources)
unittest_sources += $(omemo_unittest_sources)
endif
all_c_sources = $(core_sources) $(unittest_sources) \
$(pgp_sources) $(pgp_unittest_sources) \
$(otr3_sources) $(otr4_sources) $(otr_unittest_sources) \
$(omemo_sources) $(omemo_unittest_sources) \
$(c_sources) $(python_sources) \
$(main_source)
AM_CFLAGS = @AM_CFLAGS@ -I$(srcdir)/src
bin_PROGRAMS = profanity
@ -324,3 +331,6 @@ endif
check-unit: tests/unittests/unittests
tests/unittests/unittests
format: $(all_c_sources)
clang-format -i $(all_c_sources)