Skip to content

Commit f1312b1

Browse files
authored
Merge pull request #101 from wravery/master
Bug fix and initial clang-format config
2 parents 7fa3f9f + 367cf37 commit f1312b1

File tree

5 files changed

+133
-1
lines changed

5 files changed

+133
-1
lines changed

.clang-format

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: DontAlign
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Right
9+
AlignOperands: false
10+
AlignTrailingComments: true
11+
AllowAllArgumentsOnNextLine: false
12+
AllowAllConstructorInitializersOnNextLine: true
13+
AllowAllParametersOfDeclarationOnNextLine: true
14+
AllowShortBlocksOnASingleLine: false
15+
AllowShortCaseLabelsOnASingleLine: false
16+
AllowShortFunctionsOnASingleLine: None
17+
AllowShortLambdasOnASingleLine: None
18+
AllowShortIfStatementsOnASingleLine: Never
19+
AllowShortLoopsOnASingleLine: false
20+
AlwaysBreakAfterDefinitionReturnType: None
21+
AlwaysBreakAfterReturnType: None
22+
AlwaysBreakBeforeMultilineStrings: false
23+
AlwaysBreakTemplateDeclarations: Yes
24+
BinPackArguments: false
25+
BinPackParameters: true
26+
BraceWrapping:
27+
AfterCaseLabel: true
28+
AfterClass: true
29+
AfterControlStatement: true
30+
AfterEnum: true
31+
AfterFunction: true
32+
AfterNamespace: false
33+
AfterObjCDeclaration: false
34+
AfterStruct: true
35+
AfterUnion: true
36+
AfterExternBlock: false
37+
BeforeCatch: true
38+
BeforeElse: true
39+
IndentBraces: false
40+
SplitEmptyFunction: true
41+
SplitEmptyRecord: true
42+
SplitEmptyNamespace: true
43+
BreakBeforeBinaryOperators: NonAssignment
44+
BreakBeforeBraces: Custom
45+
BreakInheritanceList: BeforeComma
46+
BreakBeforeTernaryOperators: true
47+
BreakConstructorInitializers: BeforeComma
48+
BreakAfterJavaFieldAnnotations: false
49+
BreakStringLiterals: true
50+
ColumnLimit: 100
51+
CommentPragmas: '^ IWYU pragma:'
52+
CompactNamespaces: false
53+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
54+
ConstructorInitializerIndentWidth: 4
55+
ContinuationIndentWidth: 4
56+
Cpp11BracedListStyle: false
57+
DerivePointerAlignment: false
58+
DisableFormat: false
59+
ExperimentalAutoDetectBinPacking: false
60+
FixNamespaceComments: true
61+
ForEachMacros:
62+
- foreach
63+
- Q_FOREACH
64+
- BOOST_FOREACH
65+
IncludeBlocks: Preserve
66+
IncludeCategories:
67+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
68+
Priority: 2
69+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
70+
Priority: 3
71+
- Regex: '.*'
72+
Priority: 1
73+
IncludeIsMainRegex: '(Test)?$'
74+
IndentCaseLabels: true
75+
IndentPPDirectives: None
76+
IndentWidth: 4
77+
IndentWrappedFunctionNames: false
78+
JavaScriptQuotes: Leave
79+
JavaScriptWrapImports: true
80+
KeepEmptyLinesAtTheStartOfBlocks: true
81+
MacroBlockBegin: ''
82+
MacroBlockEnd: ''
83+
MaxEmptyLinesToKeep: 1
84+
NamespaceIndentation: None
85+
ObjCBinPackProtocolList: Auto
86+
ObjCBlockIndentWidth: 2
87+
ObjCSpaceAfterProperty: false
88+
ObjCSpaceBeforeProtocolList: true
89+
PenaltyBreakAssignment: 0
90+
PenaltyBreakBeforeFirstCallParameter: 0
91+
PenaltyBreakComment: 300
92+
PenaltyBreakFirstLessLess: 120
93+
PenaltyBreakString: 1000
94+
PenaltyBreakTemplateDeclaration: 10
95+
PenaltyExcessCharacter: 1000000
96+
PenaltyReturnTypeOnItsOwnLine: 4
97+
PointerAlignment: Left
98+
ReflowComments: true
99+
SortIncludes: false
100+
SortUsingDeclarations: true
101+
SpaceAfterCStyleCast: false
102+
SpaceAfterLogicalNot: false
103+
SpaceAfterTemplateKeyword: true
104+
SpaceBeforeAssignmentOperators: true
105+
SpaceBeforeCpp11BracedList: true
106+
SpaceBeforeCtorInitializerColon: true
107+
SpaceBeforeInheritanceColon: true
108+
SpaceBeforeParens: ControlStatements
109+
SpaceBeforeRangeBasedForLoopColon: true
110+
SpaceInEmptyParentheses: false
111+
SpacesBeforeTrailingComments: 1
112+
SpacesInAngles: false
113+
SpacesInContainerLiterals: true
114+
SpacesInCStyleCastParentheses: false
115+
SpacesInParentheses: false
116+
SpacesInSquareBrackets: false
117+
Standard: Cpp11
118+
StatementMacros:
119+
- Q_UNUSED
120+
- QT_REQUIRE_VERSION
121+
TabWidth: 4
122+
UseTab: Always
123+
...
124+

include/graphqlservice/GraphQLGrammar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ struct directive_definition_start
11071107
};
11081108

11091109
struct directive_definition_content
1110-
: seq<star<ignored>, one<'@'>, directive_name, arguments_definition, plus<ignored>, on_keyword, plus<ignored>, directive_locations>
1110+
: seq<star<ignored>, one<'@'>, directive_name, opt<star<ignored>, arguments_definition>, plus<ignored>, on_keyword, plus<ignored>, directive_locations>
11111111
{
11121112
};
11131113

samples/schema.today.graphql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ schema {
99

1010
scalar ItemCursor
1111

12+
directive @id on FIELD_DEFINITION
13+
1214
"Root Query type"
1315
type Query {
1416
"""[Object Identification](https://facebook.github.io/relay/docs/en/graphql-server-specification.html#object-identification)"""

samples/separate/TodaySchema.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ void AddTypesToSchema(const std::shared_ptr<introspection::Schema>& schema)
183183
AddNestedTypeDetails(typeNestedType, schema);
184184
AddExpensiveDetails(typeExpensive, schema);
185185

186+
schema->AddDirective(std::make_shared<introspection::Directive>("id", R"md()md", std::vector<response::StringType>({
187+
R"gql(FIELD_DEFINITION)gql"
188+
}), std::vector<std::shared_ptr<introspection::InputValue>>()));
186189
schema->AddDirective(std::make_shared<introspection::Directive>("subscriptionTag", R"md()md", std::vector<response::StringType>({
187190
R"gql(SUBSCRIPTION)gql"
188191
}), std::vector<std::shared_ptr<introspection::InputValue>>({

samples/unified/TodaySchema.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,9 @@ void AddTypesToSchema(const std::shared_ptr<introspection::Schema>& schema)
11941194
std::make_shared<introspection::Field>("order", R"md()md", std::nullopt, std::vector<std::shared_ptr<introspection::InputValue>>(), schema->WrapType(introspection::TypeKind::NON_NULL, schema->LookupType("Int")))
11951195
});
11961196

1197+
schema->AddDirective(std::make_shared<introspection::Directive>("id", R"md()md", std::vector<response::StringType>({
1198+
R"gql(FIELD_DEFINITION)gql"
1199+
}), std::vector<std::shared_ptr<introspection::InputValue>>()));
11971200
schema->AddDirective(std::make_shared<introspection::Directive>("subscriptionTag", R"md()md", std::vector<response::StringType>({
11981201
R"gql(SUBSCRIPTION)gql"
11991202
}), std::vector<std::shared_ptr<introspection::InputValue>>({

0 commit comments

Comments
 (0)