-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClangFormatRoulette.py
More file actions
125 lines (121 loc) · 5.47 KB
/
Copy pathClangFormatRoulette.py
File metadata and controls
125 lines (121 loc) · 5.47 KB
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
import random
def randbool():
return random.choice(("true", "false"))
def randint(maxv=2**31):
return random.randint(0, maxv)
def choose(a):
return random.choice(a)
with open(".clang-format", 'w') as file:
def w(option, value):
file.write(f"{option}: {value}\n")
#w("Language", "Cpp")
w("AccessModifierOffset", randint(16))
w("AlignAfterOpenBracket", randbool())
w("AlignConsecutiveAssignments", randbool())
w("AlignConsecutiveDeclarations", randbool())
w("AlignEscapedNewlines", choose(["DontAlign", "Left", "Right"]))
w("AlignOperands", randbool())
w("AlignTrailingComments", randbool())
#w("AllowAllArgumentsOnNextLine", randbool())
#w("AllowAllConstructorInitializersOnNextLine", randbool())
w("AllowAllParametersOfDeclarationOnNextLine", randbool())
w("AllowShortBlocksOnASingleLine", randbool())
w("AllowShortCaseLabelsOnASingleLine", randbool())
w("AllowShortFunctionsOnASingleLine", choose(["None", "InlineOnly", "Empty", "All"]))
w("AllowShortIfStatementsOnASingleLine", randbool())
#w("AllowShortLambdasOnASingleLine", choose(["None", "Empty", "Inline", "All"]))
w("AllowShortLoopsOnASingleLine", randbool())
w("AlwaysBreakAfterDefinitionReturnType", choose(["None", "All", "TopLevel"]))
w("AlwaysBreakAfterReturnType", choose(["None", "All", "TopLevel", "AllDefinitions", "TopLevelDefinitions"]))
w("AlwaysBreakBeforeMultilineStrings", randbool())
w("AlwaysBreakTemplateDeclarations", choose(["No", "MultiLine", "Yes"]))
w("BinPackArguments", randbool())
w("BinPackParameters", randbool())
"""w("BraceWrapping", " ")
w(" AfterCaseLabel", randbool())
w(" AfterClass", randbool())
w(" AfterControlStatement", randbool())
w(" AfterEnum", randbool())
w(" AfterFunction", randbool())
w(" AfterNamespace", randbool())
w(" AfterObjCDeclaration", randbool())
w(" AfterStruct", randbool())
w(" AfterUnion", randbool())
w(" AfterExternBlock", randbool())
w(" BeforeCatch", randbool())
w(" BeforeElse", randbool())
w(" IndentBraces", randbool())
w(" SplitEmptyFunction", randbool())
w(" SplitEmptyRecord", randbool())
w(" SplitEmptyNamespace", randbool())"""
w("BreakAfterJavaFieldAnnotations", randbool())
w("BreakBeforeBinaryOperators", choose(["None", "NonAssignment", "All"]))
w("BreakBeforeBraces", choose(["Attach", "Linux", "Mozilla", "Stroustrup", "Allman", "GNU", "WebKit", "Custom"]))
w("BreakBeforeTernaryOperators", randbool())
w("BreakConstructorInitializers", choose(["BeforeColon", "BeforeComma", "AfterColon"]))
w("BreakInheritanceList", choose(["BeforeColon", "BeforeComma", "AfterColon"]))
w("BreakStringLiterals", randbool())
w("ColumnLimit", randint())
#w("CommentPragmas", "regex")
w("CompactNamespaces", randbool())
w("ConstructorInitializerAllOnOneLineOrOnePerLine", randbool())
w("ConstructorInitializerIndentWidth", randint(16))
w("ContinuationIndentWidth", randint(16))
w("Cpp11BracedListStyle", randbool())
w("DerivePointerAlignment", randbool())
w("DisableFormat", "false")
w("ExperimentalAutoDetectBinPacking", randbool())
w("FixNamespaceComments", randbool())
#w("ForEachMacros", "nee")
w("IncludeBlocks", choose(["Preserve", "Merge", "Regroup"]))
#w("IncludeCategories", "ook nee")
#w("IncludeIsMainRegex", "regex")
w("IndentCaseLabels", randbool())
#w("IndentPPDirectives", choose(["None", "AfterHash", "BeforeHash"]))
w("IndentWidth", randint(16))
w("IndentWrappedFunctionNames", randbool())
#w("JavaImportGroups", "wederom nee")
w("JavaScriptQuotes", choose(["Leave", "Single", "Double"]))
w("JavaScriptWrapImports", randbool())
w("KeepEmptyLinesAtTheStartOfBlocks", randbool())
#w("MacroBlocksBegin", "regex")
#w("MacroBlockEnd", "regex")
w("MaxEmptyLinesToKeep", randint())
w("NamespaceIndentation", choose(["None", "Inner", "All"]))
w("ObjCBinPackProtocolList", choose(["Auto", "Always", "Never"]))
w("ObjCBlockIndentWidth", randint(16))
w("ObjCSpaceAfterProperty", randbool())
w("ObjCSpaceBeforeProtocolList", randbool())
#w("PenaltyBreakAssigment", randint())
#w("PenaltyBreakBeforeFirstCallParameter", randint())
#w("PenaltyBreakComment", randint())
#w("PenaltyBreakFirstLessLess", randint())
#w("PenaltyBreakString", randint())
#w("PenaltyBreakTemplateDeclaration", randint())
#w("PenaltyExcessCharacter", randint())
#w("PenaltyReturnTypeOnItsOwnLine", randint())
w("PointerAlignment", choose(["Left", "Right", "Middle"]))
#w("RawStringFormats", "raad eens? nee")
w("ReflowComments", randbool())
w("SortIncludes", randbool())
w("SortUsingDeclarations", randbool())
w("SpaceAfterCStyleCast", randbool())
#w("SpaceAfterLogicalNot", randbool())
w("SpaceAfterTemplateKeyword", randbool())
w("SpaceBeforeAssignmentOperators", randbool())
w("SpaceBeforeCpp11BracedList", randbool())
w("SpaceBeforeCtorInitializerColon", randbool())
w("SpaceBeforeInheritanceColon", randbool())
#w("SpaceBeforeParens", choose(["Never", "ConstrolStatements", "NonEmptyParentheses", "Always"]))
w("SpaceBeforeRangeBasedForLoopColon", randbool())
w("SpaceInEmptyParentheses", randbool())
w("SpacesBeforeTrailingComments", randint(16))
w("SpacesInAngles", randbool())
w("SpacesInCStyleCastParentheses", randbool())
w("SpacesInContainerLiterals", randbool())
w("SpacesInParentheses", randbool())
w("SpacesInSquareBrackets", randbool())
w("Standard", "Auto")
#w("StatementMacros", "nee is het antwoord")
w("TabWidth", randint(16))
w("UseTab", choose(["Never", "ForIndentation", "ForContinuationAndIndentation", "Always"]))