diff --git a/.clang-format b/.clang-format index cb03ae8..eaf3878 100644 --- a/.clang-format +++ b/.clang-format @@ -5,6 +5,7 @@ AllowAllParametersOfDeclarationOnNextLine: 'false' AlwaysBreakTemplateDeclarations: 'No' BreakBeforeBraces: Attach + BreakConstructorInitializers: BeforeComma # this is important ColumnLimit: '100' ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' IncludeBlocks: Regroup diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..99002c4 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,35 @@ +# SPDX-FileCopyrightText: 2025 Tobias Schmidl +# +# SPDX-License-Identifier: MIT + +--- +Checks: > + bugprone-*, + cert-*, + clang-analyzer-*, + cppcoreguidelines-*, + llvm-*, + -llvm-header-guard, + misc-*, + modernize-*, + performance-, + readability-* +HeaderFilterRegex: '' +ExcludeHeaderFilterRegex: '' +CheckOptions: + 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-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: true + 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 +SystemHeaders: false +... + diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..49fc38d --- /dev/null +++ b/.clangd @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Tobias Schmidl +# +# SPDX-License-Identifier: MIT + +CompileFlags: + CompilationDatabase: "build" + diff --git a/.gitignore b/.gitignore index d54a4f4..6ace428 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /build* /.vscode /cpm_modules -.DS_Store \ No newline at end of file +.DS_Store +/compile_commands.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..dd48229 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: 2025 Tobias Schmidl +# +# SPDX-License-Identifier: MIT + +--- +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-merge-conflict + - id: check-byte-order-marker +- repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: '3.4.0' + hooks: + - id: editorconfig-checker + alias: ec + stages: [pre-commit] +- repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.11.0.1 + hooks: + - id: shellcheck +- repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.45.0 + hooks: + - id: markdownlint +- repo: https://github.com/cheshirekow/cmake-format-precommit + rev: v0.6.13 + hooks: + - id: cmake-format + - id: cmake-lint +- repo: https://github.com/cpp-linter/cpp-linter-hooks + rev: v1.0.1 + hooks: + - id: clang-format + - id: clang-tidy + args: ['-p', 'os-core-flightrecorderrt-cpp/build'] +