Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker for compiling, linting, and testing #41

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e374eb1
Add Dockerfile with ARM GNU toolchain
StanleyTang17 Feb 5, 2024
de9191a
Install cmake with apt instead of wget
StanleyTang17 Feb 5, 2024
74ea547
Remove sudo from packages to install
StanleyTang17 Feb 5, 2024
1541d52
Add clang-tidy
StanleyTang17 Feb 11, 2024
326aecc
Rename clang-tidy script and add ignore paths
StanleyTang17 Feb 13, 2024
1e23fb0
Add cppcheck
StanleyTang17 Feb 14, 2024
b31e24a
Rename static analysis ignore file
StanleyTang17 Feb 16, 2024
28a5169
Two stage docker build
StanleyTang17 Feb 16, 2024
9fbeaae
Add clang-format
StanleyTang17 Feb 20, 2024
6710efd
Configure clang-tidy rules
StanleyTang17 Feb 24, 2024
ed41661
Configure clang-format rules
StanleyTang17 Feb 24, 2024
68132d4
Add helper script to extract src files
StanleyTang17 Feb 24, 2024
d3a751a
More code format config
StanleyTang17 Feb 27, 2024
988e21e
Add headers to static analysis
StanleyTang17 Feb 27, 2024
eb5bdd6
Update ignore file comment
StanleyTang17 Feb 27, 2024
e4ec515
Only include relevant files for static analysis
StanleyTang17 Mar 3, 2024
aa244a5
Docker helper script
StanleyTang17 Mar 12, 2024
a2465ac
Fix bash docker script and add exec permissions
StanleyTang17 Mar 13, 2024
e739309
Configure more rules
StanleyTang17 Mar 17, 2024
c95a76c
Docker help option and README
StanleyTang17 Mar 17, 2024
d8aabf5
Add testing support
StanleyTang17 Apr 1, 2024
c97832c
Correct clang-tidy typo
StanleyTang17 Apr 1, 2024
7b174cb
Refactor helper scripts
StanleyTang17 Apr 1, 2024
7b19a24
Combine docker images into one
StanleyTang17 Apr 12, 2024
fce10ac
Refactor folder names
StanleyTang17 Apr 12, 2024
431e5cf
Fix cppcheck FILESDIR
StanleyTang17 Apr 12, 2024
7ba5de2
Actually refactor folder names
Apr 17, 2024
945f60b
Refactor config files
StanleyTang17 Apr 17, 2024
f2437a2
Detect build json before linting
StanleyTang17 Apr 17, 2024
eed6d35
Rename container source folder
StanleyTang17 Apr 17, 2024
aa583a0
Remove default config
StanleyTang17 May 4, 2024
612473c
Update README
StanleyTang17 May 4, 2024
763b9fd
Merge branch 'main' into feature/infra/docker
StanleyTang17 May 4, 2024
8e6f44b
Run docker script in github actions
StanleyTang17 May 16, 2024
718d85a
Merge branch 'main' into feature/infra/docker
StanleyTang17 May 16, 2024
953b6d3
Add execute permission for scripts
StanleyTang17 May 16, 2024
266572d
Add init docker option
StanleyTang17 May 16, 2024
b0c4365
Add Docker init step to github actions
StanleyTang17 May 16, 2024
081125b
Update README with Mac-specific instructions
AarjavPatni May 18, 2024
d7cb4a8
Update docker script with conditional commands for MacOS
AarjavPatni May 18, 2024
37f45db
Fix syntax error on if statement
AarjavPatni May 20, 2024
66fe4f6
Add linting workflow for GH Actions
AarjavPatni May 29, 2024
c40a7be
Add build step to linting workflow
AarjavPatni May 29, 2024
5e72054
Add diff logs for clang-format; remove in place option
AarjavPatni May 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 120 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,5 +1,122 @@
---
BasedOnStyle: Google
ColumnLimit: 100
IndentWidth: '4'
Language: Cpp
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach # Our guideline prefers Attach style
BreakBeforeInheritanceComma: false
BreakInheritanceList: AfterColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: true
BreakStringLiterals: true
ColumnLimit: 100 # BARR C requires 80, but 100 is more presentable
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentCaseBlocks: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: true
IndentAccessModifiers: true
AccessModifierOffset: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: false
PackConstructorInitializers: CurrentLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterFunctionDefinitionName: true
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
...
164 changes: 164 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
Checks:
- bugprone-assignment-in-if-condition
- bugprone-bool-pointer-implicit-conversion
- bugprone-branch-clone
- bugprone-empty-catch
- bugprone-inc-dec-in-conditions
- bugprone-incorrect-roundings
- bugprone-infinite-loop
- bugprone-integer-division
- bugprone-macro-parentheses
- bugprone-parent-virtual-call
- bugprone-redundant-branch-condition
- bugprone-shared-ptr-array-mismatch
- bugprone-sizeof-container
- bugprone-sizeof-expression
- bugprone-swapped-arguments
- bugprone-switch-missing-default-case
- bugprone-unique-ptr-array-mismatch
- bugprone-virtual-near-miss
- cppcoreguidelines-avoid-do-while
- cppcoreguidelines-avoid-goto
- cppcoreguidelines-avoid-non-const-global-variables
- cppcoreguidelines-init-variables
- cppcoreguidelines-narrowing-conversions
- cppcoreguidelines-no-malloc
- cppcoreguidelines-prefer-member-initializer
- cppcoreguidelines-pro-type-member-init
- cppcoreguidelines-virtual-class-destructor
- misc-definitions-in-headers
- misc-header-include-cycle
- misc-no-recursion
- misc-non-private-member-variables-in-classes
- misc-redundant-expression
- modernize-use-equals-default
- modernize-use-equals-delete
- modernize-use-nullptr
- modernize-use-override
- readability-avoid-const-params-in-decls
- readability-avoid-unconditional-preprocessor-if
- readability-braces-around-statements
- readability-const-return-type
- readability-delete-null-pointer
- readability-duplicate-include
- readability-else-after-return
- readability-identifier-naming
- readability-implicit-bool-conversion
- readability-inconsistent-declaration-parameter-name
- readability-misleading-indentation
- readability-redundant-access-specifiers
- readability-redundant-control-flow
- readability-redundant-declaration
- readability-redundant-function-ptr-dereference
- readability-redundant-member-init
- readability-redundant-preprocessor
- readability-simplify-boolean-expr
- readability-static-accessed-through-instance
- readability-static-definition-in-anonymous-namespace
- performance-type-promotion-in-math-fn
- performance-unnecessary-value-param
WarningsAsErrors: ''
HeaderFileExtensions:
- ''
- h
- hh
- hpp
- hxx
ImplementationFileExtensions:
- c
- cc
- cpp
- cxx
HeaderFilterRegex: ''
FormatStyle: none
CheckOptions:
bugprone-empty-catch.AllowEmptyCatchForExceptions: ''
bugprone-empty-catch.IgnoreCatchWithKeywords: '@TODO;@FIXME'
bugprone-sizeof-expression.WarnOnSizeOfCompareToConstant: 'true'
bugprone-sizeof-expression.WarnOnSizeOfConstant: 'true'
bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression: 'false'
bugprone-sizeof-expression.WarnOnSizeOfPointerToAggregate: 'true'
bugprone-sizeof-expression.WarnOnSizeOfThis: 'true'
cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU'
cert-err33-c.AllowCastToVoid: 'true'
cert-err33-c.CheckedFunctions: '::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;'
cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
cppcoreguidelines-avoid-do-while.IgnoreMacros: 'false'
cppcoreguidelines-init-variables.IncludeStyle: llvm
cppcoreguidelines-init-variables.MathHeader: '<math.h>'
cppcoreguidelines-narrowing-conversions.IgnoreConversionFromTypes: ''
cppcoreguidelines-narrowing-conversions.PedanticMode: 'false'
cppcoreguidelines-narrowing-conversions.WarnOnEquivalentBitWidth: 'true'
cppcoreguidelines-narrowing-conversions.WarnOnFloatingPointNarrowingConversion: 'true'
cppcoreguidelines-narrowing-conversions.WarnOnIntegerNarrowingConversion: 'true'
cppcoreguidelines-narrowing-conversions.WarnOnIntegerToFloatingPointNarrowingConversion: 'true'
cppcoreguidelines-narrowing-conversions.WarnWithinTemplateInstantiation: 'false'
cppcoreguidelines-no-malloc.Allocations: '::malloc;::calloc'
cppcoreguidelines-no-malloc.Deallocations: '::free'
cppcoreguidelines-no-malloc.Reallocations: '::realloc'
cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true'
cppcoreguidelines-prefer-member-initializer.UseAssignment: 'false'
cppcoreguidelines-pro-type-member-init.IgnoreArrays: 'false'
cppcoreguidelines-pro-type-member-init.UseAssignment: 'false'
google-readability-braces-around-statements.ShortStatementLines: '1'
google-readability-function-size.StatementThreshold: '800'
google-readability-namespace-comments.ShortNamespaceLines: '10'
google-readability-namespace-comments.SpacesBeforeComments: '2'
llvm-else-after-return.WarnOnConditionVariables: 'false'
llvm-else-after-return.WarnOnUnfixable: 'false'
llvm-qualified-auto.AddConstToQualified: 'false'
misc-definitions-in-headers.HeaderFileExtensions: ';h;hh;hpp;hxx'
misc-definitions-in-headers.UseHeaderFileExtension: 'true'
misc-header-include-cycle.IgnoredFilesList: ''
misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'false'
misc-non-private-member-variables-in-classes.IgnorePublicMemberVariables: 'false'
modernize-use-equals-default.IgnoreMacros: 'true'
modernize-use-equals-delete.IgnoreMacros: 'true'
modernize-use-nullptr.IgnoredTypes: 'std::_CmpUnspecifiedParam::;^std::__cmp_cat::__unspec'
modernize-use-nullptr.NullMacros: 'NULL'
modernize-use-override.AllowOverrideAndFinal: 'false'
modernize-use-override.FinalSpelling: final
modernize-use-override.IgnoreDestructors: 'false'
modernize-use-override.IgnoreTemplateInstantiations: 'false'
modernize-use-override.OverrideSpelling: override
performance-type-promotion-in-math-fn.IncludeStyle: llvm
readability-avoid-const-params-in-decls.IgnoreMacros: 'true'
readability-braces-around-statements.ShortStatementLines: '0'
readability-const-return-type.IgnoreMacros: 'true'
readability-else-after-return.WarnOnConditionVariables: 'true'
readability-else-after-return.WarnOnUnfixable: 'true'
readability-identifier-naming.AggressiveDependentMemberLookup: 'false'
readability-identifier-naming.CheckAnonFieldInParent: 'false'
readability-identifier-naming.GetConfigPerFile: 'true'
readability-identifier-naming.IgnoreFailedSplit: 'false'
readability-identifier-naming.IgnoreMainLikeFunctions: 'false'
readability-identifier-naming.MacroDefinitionCase: 'UPPER_CASE'
readability-identifier-naming.VariableCase: 'camelBack'
readability-identifier-naming.StaticVariablePreffix: '_'
readability-identifier-naming.ConstantCase: 'UPPER_CASE'
readability-identifier-naming.ClassCase: 'CamelCase'
readability-identifier-naming.FunctionCase: 'camelBack'
readability-identifier-naming.MemberCase: 'camelBack'
readability-identifier-naming.MemberSuffix: '_'
readability-identifier-naming.StructCase: 'CamelCase'
readability-identifier-naming.TypedefCase: 'CamelCase'
readability-identifier-naming.TypedefSuffix: '_t'
readability-identifier-naming.EnumCase: 'CamelCase'
readability-identifier-naming.EnumSuffix: '_e'
readability-implicit-bool-conversion.AllowIntegerConditions: 'false'
readability-implicit-bool-conversion.AllowPointerConditions: 'false'
readability-inconsistent-declaration-parameter-name.IgnoreMacros: 'true'
readability-inconsistent-declaration-parameter-name.Strict: 'false'
readability-redundant-declaration.IgnoreMacros: 'true'
readability-redundant-member-init.IgnoreBaseInCopyConstructors: 'false'
readability-simplify-boolean-expr.ChainedConditionalAssignment: 'false'
readability-simplify-boolean-expr.ChainedConditionalReturn: 'false'
readability-simplify-boolean-expr.IgnoreMacros: 'false'
readability-simplify-boolean-expr.SimplifyDeMorgan: 'true'
readability-simplify-boolean-expr.SimplifyDeMorganRelaxed: 'false'
readability-static-accessed-through-instance.NameSpecifierNestingThreshold: '3'
SystemHeaders: false
...

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
.idea/
.vscode/
.DS_Store/
Tools/*/build
tools/*/build
tools/lint_output
Debug/
/.metadata/
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# ZeroPilot 3.5 Docker

Docker is our recommended way of compiling, linting and testing code, since it's cross platform and easy to use.

To get started, install Docker from their [official website](https://docs.docker.com/get-docker/) and run our docker script. It will take some time to build the Docker image and container when you run it for the first time.

## Docker Scripts
- Windows: `run_docker.ps1`
- Linux and MacOS: `run_docker.bash`

To compile the code, simply run with the `compile` option:
```
./run_docker.ps1 compile # Windows
./run_docker.bash compile # Linux and MacOS
```

Run with the `help` option to see more options such as linting and Docker container shell
```
./run_docker.ps1 help # Windows
./run_docker.bash help # Linux and MacOS
```

# ZeroPilot 3.5 Compile Commands

- A powershell script is provided for Windows
Expand Down
Loading