Skip to content
Permalink
Browse files

Add info and files for coding style. Issue #2192.

  • Loading branch information...
sledgehammer999 committed Jan 10, 2016
1 parent c75d6fd commit 5e6c38a5247d7da266d4ca3f0c5f9c7bd37bc966
Showing with 91 additions and 1 deletion.
  1. +3 −1 CODING_GUIDELINES.md
  2. +39 −0 codingStyleQtCreator.xml
  3. +49 −0 uncrustify.cfg
@@ -1,6 +1,8 @@
All new code must follow the following coding guidelines.
If you make changes in a file that still uses another coding style, make sure that you follow these guidelines for your changes instead.
**Note:** I will now take your head if you forget and use another style. However, most probably the request will be delayed until you fix your coding style.
**Note 1:** I will not take your head if you forget and use another style. However, most probably the request will be delayed until you fix your coding style.
**Note 2:** You can use the `uncrustify` program/tool to clean up any source file. Use it with the `uncrustify.cfg` configuration file found in the root folder.
**Note 3:** There is also a style for QtCreator but it doesn't cover all cases. In QtCreator `Tools->Options...->C++->Code Style->Import...` and choose the `codingStyleQtCreator.xml` file found in the root folder.

### 1. Curly braces ###
#### a. Function blocks, class/struct definitions, namespaces ####
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.2.82, 2014-11-26T02:08:28. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">true</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">false</value>
<value type="bool" key="BindStarToLeftSpecifier">true</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">true</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">false</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">true</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">1</value>
<value type="bool" key="SpacesForTabs">true</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">qBittorrent</value>
</data>
</qtcreator>
@@ -0,0 +1,49 @@
set FOR foreach

newlines = LF

indent_with_tabs = 0
indent_columns = 4
indent_switch_case = 0
indent_namespace = true
indent_class = true
indent_col1_comment = true
indent_access_spec = -4

nl_enum_brace = add
nl_union_brace = add
nl_struct_brace = add
nl_class_brace = add
nl_do_brace = remove
nl_if_brace = remove
nl_for_brace = remove
nl_else_brace = remove
nl_while_brace = remove
nl_switch_brace = remove
nl_brace_while = remove
nl_brace_else = remove
nl_try_brace = remove
nl_fcall_brace = remove
nl_fdef_brace = add
nl_after_return = false
nl_brace_else = add
nl_class_leave_one_liners = true

mod_full_brace_if = remove
mod_full_brace_do = remove
mod_full_brace_while = remove
mod_full_brace_for = remove
mod_full_brace_if_chain = true
mod_full_brace_nl = 3
mod_full_paren_if_bool = true

sp_else_brace = add
sp_try_brace = add
sp_arith = add
sp_assign = add
sp_defined_paren = ignore
sp_pp_concat = ignore
sp_pp_stringify = ignore
sp_bool = add
sp_after_class_colon = add
sp_before_class_colon = remove

0 comments on commit 5e6c38a

Please sign in to comment.
You can’t perform that action at this time.