diff --git a/.clang-format b/.clang-format index adaeac6..03c1045 100644 --- a/.clang-format +++ b/.clang-format @@ -1,2 +1,48 @@ +--- Language: Cpp -BasedOnStyle: Microsoft +BasedOnStyle: Google + +Standard: c++17 +ColumnLimit: 120 +UseTab: Never +IndentWidth: 4 +ContinuationIndentWidth: 4 +NamespaceIndentation: None + +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: true + AfterControlStatement: Never + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false + +PointerAlignment: Left +ReferenceAlignment: Left +AlwaysBreakAfterReturnType: All +AlwaysBreakAfterDefinitionReturnType: All +SortIncludes: CaseSensitive +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^".*\.h"$' + Priority: 1 + - Regex: '^".*"$' + Priority: 2 + - Regex: '^<([a-z_]+\.h)>$' + Priority: 3 + - Regex: '^<([a-z0-9_]+)>$' + Priority: 4 + - Regex: '^<(gtest|gmock|benchmark|fmt|spdlog|nlohmann|httplib)/.*>$' + Priority: 5 + - Regex: '^<(sys|linux|arpa|netinet|unistd|pthread)/.*>$' + Priority: 6 + - Regex: '^<.*>$' + Priority: 7 diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..285d34c --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,17 @@ +--- +Checks: > + -*, + bugprone-*,-bugprone-reserved-identifier,-bugprone-easily-swappable-parameters, + clang-analyzer-*, + misc-*,-misc-const-correctness,-misc-include-cleaner,-misc-unused-parameters,-misc-use-anonymous-namespace, + modernize-*,-modernize-use-trailing-return-type,-modernize-deprecated-headers,-modernize-use-nullptr, + performance-*, + portability-*, + readability-*,-readability-identifier-naming,-readability-identifier-length,-readability-implicit-bool-conversion,-readability-function-cognitive-complexity,-readability-function-size +WarningsAsErrors: '*' +HeaderFilterRegex: '^(src|examples)/.*' +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: '25' + - key: readability-function-size.LineThreshold + value: '120' diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..92b7ae0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true +max_line_length = 120 + +[*.{md,markdown}] +trim_trailing_whitespace = false + +[*.{yml,yaml,json,json5,jsonc}] +indent_size = 2 + +[Makefile] +indent_style = tab diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..47cc00a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,20 @@ +* text=auto eol=lf + +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +*.patch text eol=lf diff +*.diff text eol=lf diff +3rd/patches/** text eol=lf diff + +*.tar.gz -text -diff +*.tgz -text -diff +*.zip -text -diff +*.gz -text -diff +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.pdf binary diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..2758756 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,8 @@ +#!/bin/sh +set -eu + +script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd) +repo_root=$(git -C "$script_dir/.." rev-parse --show-toplevel 2>/dev/null) +cd "$repo_root" + +exec python3 scripts/pre_commit.py "$@" diff --git a/.gitignore b/.gitignore index 51ff265..c58d7e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,42 @@ +# Build directories and generated CMake output +/build/ +/build-*/ +/cmake-build-*/ +/out/ +CMakeFiles/ +CMakeCache.txt +cmake_install.cmake +CTestTestfile.cmake +DartConfiguration.tcl +Testing/ +install_manifest.txt compile_commands.json -.cache -build/ +CMakeUserPresets.json + +# Python caches +__pycache__/ +*.py[cod] +*$py.class +.pytest_cache/ +.mypy_cache/ +.ruff_cache/ +.pyright/ + +# Local tooling and transient output +.cache/ +.codegraph/ +.oc-whiteboard/ +.opencode/ +*.log +*.tmp +*.temp +.tmp/ +tmp/ +temp/ + +# Keep vendored inputs trackable for the reusable offline template +!3rd/ +!3rd/archives/ +!3rd/archives/*.tar.gz +!3rd/patches/ +!3rd/patches/**