Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
3bbc47a
Add clang-format, clang-tidy, and compiler CI matrix
flyingrobots Oct 23, 2025
d917182
docs: rename 'mg-ledger' to 'git-ledger'
flyingrobots Oct 23, 2025
29a758e
docs: formatting in a few documents
flyingrobots Oct 23, 2025
68295c0
Add ACTIVITY.log.jsonl
flyingrobots Oct 23, 2025
ad41407
Logged the orientation leg of the journey
flyingrobots Oct 23, 2025
d310fa2
Taught the version printer to speak without snprintf
flyingrobots Oct 23, 2025
997a27c
Let the workflow toggle run_tidy without lying
flyingrobots Oct 23, 2025
0e776d7
Recorded the lint fix trail in the ledger
flyingrobots Oct 23, 2025
da7b763
Stopped apt from chasing a mythical clang++
flyingrobots Oct 23, 2025
14ac526
Logged the package fix for the clang lane
flyingrobots Oct 23, 2025
b6293a0
Let clang-format tidy the hand-rolled formatter
flyingrobots Oct 23, 2025
bd3ce16
Renamed the METAGRAPH prefix to GITLEDGER where it matters
flyingrobots Oct 23, 2025
e41172f
Logged the METAGRAPH to GITLEDGER rename prep
flyingrobots Oct 23, 2025
d6e3223
Built a docker harness so local builds mirror CI
flyingrobots Oct 23, 2025
e4b1c06
Told the docs to trust the docker harness, not your host
flyingrobots Oct 23, 2025
23dd8b5
Refused host targets unless you shout the magic words
flyingrobots Oct 23, 2025
be9a904
Told git inside the container that our sandbox is safe
flyingrobots Oct 23, 2025
d11e379
Untangled PROJECT-PLAN headings for the lint police
flyingrobots Oct 23, 2025
4d5e392
Let clang-format sort includes again
flyingrobots Oct 23, 2025
11416bd
Killed the stray modernize knobs in clang-tidy
flyingrobots Oct 23, 2025
af9e5bf
Taught editorconfig about our shell and build scripts
flyingrobots Oct 23, 2025
043cfee
Tightened workflow branch lists to pass lint
flyingrobots Oct 23, 2025
908ab94
Taught clang-tidy to ignore test translation units
flyingrobots Oct 23, 2025
cad732d
Aligned CI labels with real GCC/Clang versions
flyingrobots Oct 23, 2025
ea143da
Taught CI to check Docker before invoking containerised builds
flyingrobots Oct 23, 2025
3abc1c2
Settled on C17 and applied warnings per target
flyingrobots Oct 23, 2025
d5b748a
Made semantic version components unsigned
flyingrobots Oct 23, 2025
c4e498d
Hard-pinned C17 in every cmake invocation
flyingrobots Oct 23, 2025
65f10c3
Gave the Makefile conventional all/test targets
flyingrobots Oct 23, 2025
6047c41
Defaulted lint/format to host targets with container aliases
flyingrobots Oct 23, 2025
a1884a1
Meson: lowercase tests target and stick with C17
flyingrobots Oct 23, 2025
48b1641
Added gitledger_semantic_version_snprintf and a safer static wrapper
flyingrobots Oct 23, 2025
adbc498
Pinned dev container packages to Ubuntu 24.04 versions
flyingrobots Oct 23, 2025
eb1604c
Kept version test checking snprintf result under NDEBUG
flyingrobots Oct 23, 2025
48089be
Let clang-tidy breathe without rebuilding the world
flyingrobots Oct 23, 2025
5d0db6b
Defused the fixture script's rm -rf tripwire
flyingrobots Oct 23, 2025
f84af2b
Merge branch 'origin/main' into feat/coding-standards
flyingrobots Oct 23, 2025
aca80f8
Recorded merge activity entry
flyingrobots Oct 23, 2025
8e2ce60
Anchored clang-tidy filters and documented cert exceptions
flyingrobots Oct 23, 2025
2a5f092
Made clang-tidy roots configurable
flyingrobots Oct 23, 2025
5daf608
Trimmed editorconfig to meaningful overrides
flyingrobots Oct 23, 2025
13729dc
Brought PROJECT-PLAN.md back into markdownlint compliance
flyingrobots Oct 23, 2025
844dbb5
Hardened fixture path resolution ladder
flyingrobots Oct 23, 2025
4b626fc
Routed format-check through containers and added markdownlint target
flyingrobots Oct 23, 2025
133486f
Handled printf results in CLI smoke binaries
flyingrobots Oct 23, 2025
57888e5
Logged push after review fixes
flyingrobots Oct 23, 2025
f263ef9
Let clang-format unify the ledger’s style again
flyingrobots Oct 23, 2025
8bc83ac
Taught the lint harness to police itself
flyingrobots Oct 23, 2025
1c0ee82
Defused the non-breaking hyphen minefield
flyingrobots Oct 23, 2025
c1182c7
Gave the ledger a make log confession booth
flyingrobots Oct 23, 2025
12b8eec
Taught the activity schema to reject bogus PR links
flyingrobots Oct 23, 2025
34a7516
Journaled the schema tightening in the activity log
flyingrobots Oct 23, 2025
53c4aa9
CI now dry-runs the containerized make targets
flyingrobots Oct 23, 2025
70ee8e9
Let the fixture helper breathe under /tmp
flyingrobots Oct 23, 2025
04269d9
Annotated the Makefile's host guard escape hatch
flyingrobots Oct 23, 2025
ca66f04
Deleted the pointless container aliases
flyingrobots Oct 23, 2025
5520b1f
Explained how to flip RUN_TIDY when clang-tidy drags
flyingrobots Oct 23, 2025
7853827
Moved activity logging plumbing into a script
flyingrobots Oct 23, 2025
dd60300
Tightened the PR URL regex without ajv formats
flyingrobots Oct 23, 2025
b4ccea2
Logged the container matrix shakedown
flyingrobots Oct 23, 2025
76d3052
Gave the log dispatcher real WHERE handling
flyingrobots Oct 23, 2025
b6ad85c
Let markdownlint fix the autogenerated drafts
flyingrobots Oct 23, 2025
b3936c8
ShellCheck won't roast our fixture guard anymore
flyingrobots Oct 23, 2025
99c437b
Schema knows URIs and CI reads the matrix
flyingrobots Oct 23, 2025
94c55a3
Teach the log dispatcher to respect spaces
flyingrobots Oct 23, 2025
1f7fac8
Release builds now export compile_commands too
flyingrobots Oct 23, 2025
ec85096
Ajv now tolerates schema format hints
flyingrobots Oct 23, 2025
d1b59c9
Use ajv's plural unknown-formats flag
flyingrobots Oct 23, 2025
8ebbe47
Ajv strict mode off for schema validation
flyingrobots Oct 23, 2025
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
19 changes: 19 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 100
UseTab: Never
BreakBeforeBraces: GNU
AllowShortIfStatementsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortBlocksOnASingleLine: Empty
PointerAlignment: Left
DerivePointerAlignment: false
SpaceBeforeCpp11BracedList: true
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveDeclarations: Consecutive
AlignTrailingComments: true
SpaceAfterCStyleCast: true
SpaceBeforeParens: ControlStatements
IncludeBlocks: Preserve
# Keep include sorting enabled to ensure consistent formatter output across tooling.
SortIncludes: true
81 changes: 81 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
Checks: >
-*,
bugprone-*,
cert-*,
clang-analyzer-*,
concurrency-*,
misc-*,
performance-*,
portability-*,
readability-*,
-readability-magic-numbers,
-bugprone-easily-swappable-parameters
WarningsAsErrors: '*'
HeaderFilterRegex: '^(include|src|libgitledger)/.*\.(h|c)$'
CheckOptions:
- key: readability-identifier-naming.TypedefCase
value: lower_case
- key: readability-identifier-naming.StructCase
value: lower_case
- key: readability-identifier-naming.UnionCase
value: lower_case
- key: readability-identifier-naming.EnumCase
value: lower_case
- key: readability-identifier-naming.EnumConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.EnumConstantPrefix
value: 'GITLEDGER_'
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.FunctionPrefix
value: ''
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.MacroDefinitionCase
value: UPPER_CASE
- key: readability-identifier-naming.MacroDefinitionPrefix
value: 'GITLEDGER_'
- key: readability-identifier-naming.GlobalConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.GlobalConstantPrefix
value: 'GITLEDGER_'
- key: readability-function-cognitive-complexity.Threshold
value: '25'
- key: readability-function-size.LineThreshold
value: '50'
- key: readability-function-size.StatementThreshold
value: '60'
- key: readability-function-size.BranchThreshold
value: '15'
- key: readability-function-size.ParameterThreshold
value: '8'
- key: readability-function-size.NestingThreshold
value: '5'
- key: readability-function-size.CallThreshold
value: '30'
- key: bugprone-suspicious-string-compare.WarnOnImplicitComparison
value: 'true'
- key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison
value: 'true'
- key: cert-err33-c.CheckedFunctions
# Mirror the cert-err33-c default allowlist so we can trim entries locally in future diffs.
value: |
::aligned_alloc;::calloc;::clock;::fclose;::ferror;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;
::fprintf;::fputc;::fputs;::fputwc;::fread;::freopen;::fscanf;::fseek;::fsetpos;::ftell;::fwprintf;
::fwrite;::fwscanf;::getc;::getchar;::gets;::getwc;::getwchar;::gmtime;::localtime;::malloc;::mbrtowc;
::mbsrtowcs;::mbstowcs;::memchr;::mktime;::printf;::putc;::putchar;::puts;::putwc;::putwchar;::raise;
::realloc;::remove;::rename;::scanf;::setlocale;::setvbuf;::signal;::snprintf;::sprintf;::sscanf;::strchr;
::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtol;
::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swscanf;::time;::tmpfile;::tmpnam;
::ungetc;::ungetwc;::vfprintf;::vfscanf;::vfwprintf;::vfwscanf;::vprintf;::vscanf;::vsnprintf;::vsprintf;
::vsscanf;::vswprintf;::vswscanf;::vwprintf;::vwscanf;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;
::wcsrtombs;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstol;::wcstoll;::wcstombs;::wcstoul;
::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wmemchr;::wprintf;::wscanf
- key: performance-move-const-arg.CheckTriviallyCopyableMove
value: 'false'
- key: performance-no-automatic-move.AllowedTypes
value: ''
- key: misc-misplaced-const.CheckPrimitiveCasts
value: 'true'
39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{c,h}]
indent_style = space
indent_size = 4

[*.{yml,yaml,json,md,txt}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
indent_size = tab
tab_width = 4

[*.sh]
indent_style = space
indent_size = 2

[CMakeLists.txt]
indent_style = space
indent_size = 2

[*.cmake]
indent_style = space
indent_size = 2

[meson.build]
indent_style = space
indent_size = 2
126 changes: 126 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: CI

on:
push:
branches: [main, feat/coding-standards]
pull_request:
branches: [main]

jobs:
linux-matrix:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: GCC 14 (Ubuntu 24.04)
os: ubuntu-24.04
cc: gcc-14
cxx: g++-14
packages: gcc-14 g++-14 clang-format-18 clang-tidy-18
clang_format: clang-format-18
clang_tidy: clang-tidy-18
run_tidy: true
- name: Clang 18 (Ubuntu 24.04)
os: ubuntu-24.04
cc: clang-18
cxx: clang++-18
packages: clang-18 clang++-18 clang-format-18 clang-tidy-18
clang_format: clang-format-18
clang_tidy: clang-tidy-18
run_tidy: false
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CLANG_FORMAT: ${{ matrix.clang_format }}
CLANG_TIDY: ${{ matrix.clang_tidy }}
LIBGITLEDGER_CONTAINER_IMAGE: libgitledger-ci:latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential ninja-build cmake python3-pip rsync ${{ matrix.packages }}
python3 -m pip install --upgrade pip
python3 -m pip install meson

- name: Display toolchain versions
run: |
${CC} --version
${CXX} --version
${CLANG_FORMAT} --version
${CLANG_TIDY} --version
cmake --version
meson --version

- name: Verify Docker availability
run: docker version

- name: Pre-build CI container image
run: docker build -t libgitledger-ci:latest -f tools/container/Dockerfile .

- name: Verify make targets exist
# The container dispatch script expects these orchestrated targets; a dry run proves they resolve.
run: |
for target in cmake test-cmake meson test-meson format-check tidy; do
make -n "$target" >/dev/null
done

- name: Build with CMake
run: make cmake

- name: Run CMake tests
run: make test-cmake

- name: Build with Meson
run: make meson

- name: Run Meson tests
run: make test-meson

- name: clang-format check
run: make format-check

- name: clang-tidy check
if: ${{ matrix.run_tidy }}
# tools/lint/run_clang_tidy.sh filters compile_commands.json to exclude test TU entries
run: make tidy

- name: Validate activity log schema
run: make activity-validate

windows-msvc:
name: MSVC (Windows)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install meson ninja
choco install ninja -y
shell: pwsh

- name: Configure CMake (Ninja)
run: cmake -S . -B build-msvc -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_STANDARD=17 -DCMAKE_C_STANDARD_REQUIRED=ON
shell: pwsh

- name: Build
run: cmake --build build-msvc
shell: pwsh

- name: Run CTest
run: ctest --test-dir build-msvc --output-on-failure
shell: pwsh

- name: Configure Meson
run: |
meson setup meson-msvc --buildtype release
meson compile -C meson-msvc
meson test -C meson-msvc --print-errorlogs
shell: pwsh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Icon
build/
build-debug/
build-release/
build-tidy/
meson-debug/
meson-release/
meson-*/
Expand Down
9 changes: 9 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MD013:
line_length: 240
code_blocks: false
tables: false
MD041: true
MD024:
siblings_only: true
MD029:
style: ordered
Loading