-
Notifications
You must be signed in to change notification settings - Fork 145
/
arduino-code-style.conf
127 lines (84 loc) · 4.28 KB
/
arduino-code-style.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# source: https:/arduino/ArduinoCore-avr/issues/71#issuecomment-466763471 2019-06-09
# formatter.conf, examples_formatter.conf
mode=c
# examples_formatter.conf
# http://astyle.sourceforge.net/astyle.html#_style=java
# Considering changing this to the synonym "style=attach", which seems more descriptive
style=java
# examples_formatter.conf
attach-namespaces
# examples_formatter.conf
attach-classes
# examples_formatter.conf
attach-inlines
# examples_formatter.conf
attach-extern-c
# formatter.conf, examples_formatter.conf
indent=spaces=2
# formatter.conf, examples_formatter.conf
indent-classes
# formatter.conf, examples_formatter.conf
indent-switches
# formatter.conf, examples_formatter.conf
indent-cases
# formatter.conf, examples_formatter.conf
indent-col1-comments
# examples_formatter.conf
indent-modifiers
# examples_formatter.conf
indent-namespaces
# examples_formatter.conf
indent-labels
# examples_formatter.conf
indent-preproc-define
# formatter.conf, examples_formatter.conf
pad-header
# formatter.conf, examples_formatter.conf
pad-oper
# examples_formatter.conf
# Uh, no you can't remove the padding that I put there to make related functions line up with each other.
# unpad-paren
# formatter.conf, examples_formatter.conf
# remove-comment-prefix
# formatter.conf, examples_formatter.conf
# http://astyle.sourceforge.net/astyle.html#_keep-one-line-statements
# "Don't break complex statements and multiple statements residing on a single line."
# I don't like one line complex statements, but I guess since it's in formatter.conf it must stay.
keep-one-line-statements
# Options from examples_formatter.conf that I think should be removed:
# http://astyle.sourceforge.net/astyle.html#_indent-preproc-block
# "Indent preprocessor blocks at brace level zero and immediately within a namespace. There are restrictions on what will be indented. Blocks within methods, classes, arrays, etc., will not be indented. Blocks containing braces or multi-line define statements will not be indented. Without this option the preprocessor block is not indented."
# This does indent for #ifdef, but not for #ifndef, so it's quite inconsistent
# Indentation of preprocessor directives as done by this option is not very common in Arduino AVR Boards core, and where it is used, it's typically done inconsistently throughout the file
indent-preproc-block
# http://astyle.sourceforge.net/astyle.html#_indent-preproc-cond
# "Indent preprocessor conditional statements to the same level as the source code."
# Indentation of preprocessor directives as done by this option is very rare in Arduino AVR Boards core
indent-preproc-cond
# Options I have not implemented from formatter.conf or examples_formatter.conf:
# examples_formatter.conf
# Not a valid option in the latest version of AStyle. I think the correct option name is "add-braces", which I do use in my configuration
# add-brackets
# formatter.conf, examples_formatter.conf
# Not a valid option in the latest version of AStyle.
# indent-preprocessor
# Options I have added:
# http://astyle.sourceforge.net/astyle.html#_add-braces
# "I believe this is the correct option name to use instead the "add-brackets" option used in examples_formatter.conf. "add-brackets" is not a valid option in the latest version of AStyle"
add-braces
# http://astyle.sourceforge.net/astyle.html#_convert-tabs
# "Converts tabs into spaces in the non-indentation part of the line."
# AStyle is already configured to use spaces for indentation by indent=spaces=2. The Arduino IDE uses spaces instead of tabs by default.
convert-tabs
# http://astyle.sourceforge.net/astyle.html#_attach-return-type
# "Attach the return type to the function name in function definitions."
attach-return-type
# http://astyle.sourceforge.net/astyle.html#_attach-return-type
# "Attach the return type to the function name in function declarations."
attach-return-type-decl
# http://astyle.sourceforge.net/astyle.html#_align-pointer
# "Attach a pointer or reference operator (*, &, or ^) to either the variable type (left) or variable name (right), or place it between the type and name (middle)."
#
# Spence: Not gonna take a side on this. My own preferences are not really consistent. Type is clearly more correct,
# but name alignment feels better, though neither of them feel natural.....
# align-pointer=name