forked from scott/threaded_network_chat
add editorconfig and clang-format files
This commit is contained in:
32
formatting-configs/.editorconfig
Normal file
32
formatting-configs/.editorconfig
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 8
|
||||||
|
tab_width = 8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.{c,cc,cpp,h,hpp}]
|
||||||
|
|
||||||
|
# Unbraced single-statement blocks
|
||||||
|
cpp_remove_braces_for_single_line_control_statements = true
|
||||||
|
resharper_cpp_remove_braces_for_single_statements = true
|
||||||
|
resharper_cpp_add_braces_for_single_line_if = false
|
||||||
|
|
||||||
|
# Enforce BSD KNF for function bracess
|
||||||
|
cpp_new_line_before_open_brace_function = new_line
|
||||||
|
resharper_cpp_brace_style = next_line
|
||||||
|
resharper_cpp_function_definition_braces = next_line
|
||||||
|
|
||||||
|
# Enforce K&R for everything else
|
||||||
|
cpp_new_line_before_open_brace_namespace = same_line
|
||||||
|
cpp_new_line_before_open_brace_type = same_line
|
||||||
|
cpp_new_line_before_open_brace_block = same_line
|
||||||
|
cpp_new_line_before_open_brace_lambda = same_line
|
||||||
|
cpp_new_line_before_else = false
|
||||||
|
cpp_new_line_before_catch = false
|
||||||
|
resharper_cpp_namespace_declaration_braces = end_of_line
|
||||||
|
resharper_cpp_type_declaration_braces = end_of_line
|
||||||
|
resharper_cpp_control_transfer_braces = end_of_line
|
||||||
19
formatting-configs/clang-format.json
Normal file
19
formatting-configs/clang-format.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"BasedOnStyle": "LLVM",
|
||||||
|
"UseTab": "Always",
|
||||||
|
"IndentWidth": 8,
|
||||||
|
"TabWidth": 8,
|
||||||
|
"LineEnding": "LF",
|
||||||
|
"RemoveBracesLLVM": true,
|
||||||
|
"AlwaysBreakAfterReturnType": "AllDefinitions",
|
||||||
|
"BreakBeforeBraces": "Custom",
|
||||||
|
"BraceWrapping": {
|
||||||
|
"AfterFunction": true,
|
||||||
|
"AfterClass": false,
|
||||||
|
"AfterControlStatement": false,
|
||||||
|
"AfterNamespace": false,
|
||||||
|
"AfterStruct": false,
|
||||||
|
"BeforeElse": false,
|
||||||
|
"BeforeCatch": false
|
||||||
|
}
|
||||||
|
}
|
||||||
20
formatting-configs/clang-format.yml
Normal file
20
formatting-configs/clang-format.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# BSD KNF funcs + K&R blocks + other stuff
|
||||||
|
# Requires clang-format >=16
|
||||||
|
BasedOnStyle: LLVM # defaults
|
||||||
|
UseTab: Always
|
||||||
|
IndentWidth: 8
|
||||||
|
TabWidth: 8
|
||||||
|
LineEnding: LF # unix
|
||||||
|
|
||||||
|
RemoveBracesLLVM: true # single-statement blocks
|
||||||
|
AlwaysBreakAfterReturnType: AllDefinitions # KNF functions
|
||||||
|
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterFunction: true # KNF
|
||||||
|
AfterClass: false # K&R
|
||||||
|
AfterControlStatement: false # K&R
|
||||||
|
AfterNamespace: false # K&R
|
||||||
|
AfterStruct: false # K&R
|
||||||
|
BeforeElse: false # K&R
|
||||||
|
BeforeCatch: false # K&R
|
||||||
Reference in New Issue
Block a user