Skip to content

Commit f7cc8de

Browse files
committed
Improve development tools configuration and documentation
1 parent be3e6a2 commit f7cc8de

15 files changed

+995
-314
lines changed

.clang-format

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,93 @@
1+
# QGroundControl C++ Code Formatting
2+
# Based on Google style with QGC customizations
3+
# Matches CodingStyle.cc/h patterns
4+
15
BasedOnStyle: Google
6+
Language: Cpp
7+
8+
# Line length and indentation
29
ColumnLimit: 120
310
IndentWidth: 4
11+
TabWidth: 4
12+
UseTab: Never
13+
ContinuationIndentWidth: 4
14+
15+
# Bracing - Custom QGC style
16+
# Functions/Classes: New line (Allman)
17+
# Control statements: Same line (K&R)
18+
BreakBeforeBraces: Custom
19+
BraceWrapping:
20+
AfterClass: true
21+
AfterControlStatement: Never
22+
AfterEnum: true
23+
AfterFunction: true
24+
AfterNamespace: false
25+
AfterStruct: true
26+
AfterUnion: true
27+
BeforeCatch: false
28+
BeforeElse: false
29+
IndentBraces: false
30+
SplitEmptyFunction: true
31+
SplitEmptyRecord: true
32+
AllowShortFunctionsOnASingleLine: None
33+
AllowShortIfStatementsOnASingleLine: Never
34+
AllowShortLoopsOnASingleLine: false
35+
AllowShortBlocksOnASingleLine: Never
36+
AllowShortCaseLabelsOnASingleLine: false
37+
38+
# Pointer and reference alignment
39+
PointerAlignment: Left
40+
ReferenceAlignment: Left
41+
DerivePointerAlignment: false
42+
43+
# Spacing
44+
SpaceAfterCStyleCast: false
45+
SpaceAfterLogicalNot: false
46+
SpaceBeforeAssignmentOperators: true
47+
SpaceBeforeParens: ControlStatements
48+
SpaceInEmptyParentheses: false
49+
SpacesInAngles: Never
50+
SpacesInCStyleCastParentheses: false
51+
SpacesInParentheses: false
52+
SpacesInSquareBrackets: false
53+
54+
# Include sorting
55+
SortIncludes: CaseSensitive
56+
IncludeBlocks: Regroup
57+
IncludeCategories:
58+
- Regex: '^<Q.*>' # Qt headers
59+
Priority: 1
60+
- Regex: '^<.*>' # System/STL headers
61+
Priority: 2
62+
- Regex: '.*' # Project headers
63+
Priority: 3
64+
65+
# Alignment
66+
AlignAfterOpenBracket: Align
67+
AlignConsecutiveAssignments: None
68+
AlignConsecutiveDeclarations: None
69+
AlignOperands: Align
70+
AlignTrailingComments:
71+
Kind: Always
72+
OverEmptyLines: 1
73+
74+
# Line breaks
75+
AlwaysBreakAfterReturnType: None
76+
AlwaysBreakTemplateDeclarations: Yes
77+
BreakBeforeBinaryOperators: None
78+
BreakBeforeTernaryOperators: true
79+
BreakConstructorInitializers: BeforeColon
80+
BreakInheritanceList: BeforeColon
81+
ConstructorInitializerIndentWidth: 4
82+
83+
# Namespace formatting
84+
CompactNamespaces: false
85+
NamespaceIndentation: None
86+
87+
# Other formatting
88+
BinPackArguments: true
89+
BinPackParameters: true
90+
KeepEmptyLinesAtTheStartOfBlocks: false
91+
MaxEmptyLinesToKeep: 1
92+
ReflowComments: true
93+
Standard: c++20

.clang-tidy

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,66 @@
1+
# QGroundControl C++ Static Analysis
2+
# Clang-Tidy configuration for C++20 and Qt 6
3+
14
---
25
Checks: >
3-
clang-analyzer-*,
4-
WarningsAsErrors: '*'
6+
-*,
7+
bugprone-*,
8+
-bugprone-easily-swappable-parameters,
9+
-bugprone-exception-escape,
10+
clang-analyzer-*,
11+
-clang-analyzer-cplusplus.NewDeleteLeaks,
12+
modernize-*,
13+
-modernize-use-trailing-return-type,
14+
-modernize-avoid-c-arrays,
15+
performance-*,
16+
readability-*,
17+
-readability-magic-numbers,
18+
-readability-identifier-length,
19+
-readability-function-cognitive-complexity,
20+
cppcoreguidelines-*,
21+
-cppcoreguidelines-avoid-magic-numbers,
22+
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
23+
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
24+
-cppcoreguidelines-pro-type-vararg,
25+
-cppcoreguidelines-avoid-const-or-ref-data-members,
26+
27+
WarningsAsErrors: '' # Don't treat warnings as errors by default
28+
29+
CheckOptions:
30+
# Naming conventions (match QGC style)
31+
- key: readability-identifier-naming.ClassCase
32+
value: CamelCase
33+
- key: readability-identifier-naming.StructCase
34+
value: CamelCase
35+
- key: readability-identifier-naming.EnumCase
36+
value: CamelCase
37+
- key: readability-identifier-naming.FunctionCase
38+
value: camelBack
39+
- key: readability-identifier-naming.VariableCase
40+
value: camelBack
41+
- key: readability-identifier-naming.PrivateMemberPrefix
42+
value: '_'
43+
- key: readability-identifier-naming.ProtectedMemberPrefix
44+
value: '_'
45+
- key: readability-identifier-naming.ConstexprVariableCase
46+
value: CamelCase
47+
48+
# Modernization options
49+
- key: modernize-use-nullptr.NullMacros
50+
value: 'NULL'
51+
- key: modernize-loop-convert.MinConfidence
52+
value: 'reasonable'
53+
54+
# Performance options
55+
- key: performance-for-range-copy.WarnOnAllAutoCopies
56+
value: 'true'
57+
- key: performance-move-const-arg.CheckTriviallyCopyableMove
58+
value: 'true'
59+
60+
# Readability options
61+
- key: readability-braces-around-statements.ShortStatementLines
62+
value: '0' # Always require braces
63+
64+
HeaderFilterRegex: '.*'
65+
FormatStyle: file
566
...

.clangd

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
# QGroundControl Clangd Configuration
2+
# Language server for C++ code completion and navigation
3+
4+
CompileFlags:
5+
Add:
6+
- "-std=c++20"
7+
- "-Wall"
8+
- "-Wextra"
9+
Remove:
10+
- "-m*" # Remove machine-specific flags
11+
112
Diagnostics:
13+
# Qt macros and moc generate code that triggers false positives
214
UnusedIncludes: None
315
MissingIncludes: None
16+
# Suppress common Qt-related warnings
17+
Suppress:
18+
- "unknown_typename"
19+
- "expansion_to_defined"
20+
21+
Index:
22+
Background: Build
23+
StandardLibrary: Yes
24+
25+
InlayHints:
26+
Enabled: Yes
27+
ParameterNames: Yes
28+
DeducedTypes: Yes
29+
Designators: Yes
30+
31+
Hover:
32+
ShowAKA: Yes

.cmake-format

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1+
# QGroundControl CMake Formatting Configuration
2+
# Used by cmake-format for consistent CMake file formatting
3+
# Install: pip install cmake-format
4+
15
format:
2-
line_width: 120
3-
tab_size: 4
4-
max_prefix_chars: 40
5-
use_tabchars: false
6+
line_width: 120
7+
tab_size: 4
8+
max_prefix_chars: 40
9+
use_tabchars: false
10+
dangle_parens: true
11+
dangle_align: prefix
12+
max_subgroups_hwrap: 2
13+
max_pargs_hwrap: 6
14+
separate_ctrl_name_with_space: false
15+
separate_fn_name_with_space: false
16+
command_case: canonical
617

718
parse:
819
additional_commands:
20+
# CPM Package Manager commands
921
cpmaddpackage:
1022
pargs:
1123
nargs: '*'
@@ -41,3 +53,40 @@ parse:
4153
flags: []
4254
spelling: CPMFindPackage
4355
kwargs: *cpmaddpackagekwargs
56+
57+
# Qt macros
58+
qt_add_qml_module:
59+
pargs:
60+
nargs: '1+'
61+
kwargs:
62+
URI: 1
63+
VERSION: 1
64+
QML_FILES: +
65+
SOURCES: +
66+
RESOURCES: +
67+
OUTPUT_DIRECTORY: 1
68+
RESOURCE_PREFIX: 1
69+
70+
qt_add_resources:
71+
pargs:
72+
nargs: '2+'
73+
kwargs:
74+
PREFIX: 1
75+
FILES: +
76+
77+
markup:
78+
enable_markup: false
79+
80+
lint:
81+
disabled_codes: []
82+
function_pattern: '[0-9a-z_]+'
83+
macro_pattern: '[0-9A-Z_]+'
84+
global_var_pattern: '[A-Z][0-9A-Z_]+'
85+
internal_var_pattern: '_[A-Z][0-9A-Z_]+'
86+
local_var_pattern: '[a-z][a-z0-9_]+'
87+
private_var_pattern: '_[0-9a-z_]+'
88+
public_var_pattern: '[A-Z][0-9A-Z_]+'
89+
keyword_pattern: '[A-Z][0-9A-Z_]+'
90+
max_conditionals_custom_parser: 2
91+
min_statement_spacing: 1
92+
max_statement_spacing: 2

.editorconfig

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,64 @@
1+
# QGroundControl EditorConfig
2+
# https://editorconfig.org/
3+
14
root = true
25

6+
# Default settings for all files
37
[*]
48
charset = utf-8
59
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
end_of_line = lf
12+
13+
# C++ source files
14+
[*.{cc,h,cpp,hpp,cxx}]
15+
indent_style = space
16+
indent_size = 4
17+
max_line_length = 120
18+
19+
# CMake files
20+
[{CMakeLists.txt,*.cmake}]
21+
indent_style = space
22+
indent_size = 4
23+
24+
# QML and JavaScript
25+
[*.{qml,js}]
26+
indent_style = space
27+
indent_size = 4
28+
29+
# JSON files
30+
[*.json]
31+
indent_style = space
32+
indent_size = 2
33+
34+
# YAML files
35+
[*.{yml,yaml}]
36+
indent_style = space
37+
indent_size = 2
38+
39+
# Markdown files
40+
[*.md]
41+
indent_style = space
42+
indent_size = 2
43+
trim_trailing_whitespace = false # Preserve trailing spaces for line breaks
44+
45+
# XML files (including Qt resource files)
46+
[*.{xml,qrc,ui}]
47+
indent_style = space
48+
indent_size = 2
49+
50+
# Shell scripts
51+
[*.sh]
52+
indent_style = space
53+
indent_size = 2
54+
end_of_line = lf
55+
56+
# Python scripts
57+
[*.py]
658
indent_style = space
759
indent_size = 4
8-
trim_trailing_whitespace=true
60+
max_line_length = 100
61+
62+
# Makefiles (require tabs)
63+
[{Makefile,*.mk}]
64+
indent_style = tab

0 commit comments

Comments
 (0)