Fix: Code and documentation formatting #44

Merged
erikinkinen merged 5 commits from 0-fix-formatting into main 2026-02-04 11:21:20 +01:00
Owner

Task

Closes #43


Summary

This PR introduces formatting enforcement in CI to prevent unformatted code and documentation changes from landing on main. It adds two Forgejo Actions workflows:

  • clang-format check for C/C++ sources using the repository’s .clang-format
  • markdownlint for all *.md files using a repo-pinned configuration

It also fixes a key mismatch by aligning .clang-format’s language standard with the actual project language level (C++20), and applies formatting cleanups to existing files so the new checks pass immediately.


Motivation

Formatting consistency was previously missed in #2/#42. Relying only on local tooling and pre-commit hooks is not sufficient; CI must provide a hard, repeatable guardrail so main remains mechanically consistent.


Changes

CI

  • Add .forgejo/workflows/clang-format.yml to verify that tracked C/C++ files match clang-format -style=file
  • Add .forgejo/workflows/markdownlint.yml to lint Markdown in CI

Configuration

  • Update .clang-format to Standard: c++20 (was Cpp03)
  • Add .markdownlint.json as the repository’s markdown linting policy

Pre-commit

  • Add Markdown lint hook to .pre-commit-config.yaml (keeps local workflow consistent with CI)

Mechanical formatting fixes

  • Reflow long lines in README.md, docs/phase0.md, docs/model.md, docs/formatting.md
  • Apply .clang-format-consistent formatting to core headers and test sources

Notes

  • This is a mechanical-only PR. No semantic behavior or simulator logic changes are introduced.

  • CI enforcement is intentionally scoped to format-only checks:

    • clang-format for *.{c,cc,cpp,cxx,h,hh,hpp}
    • markdownlint for **/*.md
  • The .clang-format standard was updated to match the project’s compilation level (C++20), so formatting is parsed consistently with the codebase.


Verification

  • Formatting check passes locally with clang-format -style=file
  • Markdown lint passes with repository config
  • Existing CI smoke build remains unaffected
### Task Closes #43 --- ### Summary This PR introduces **formatting enforcement in CI** to prevent unformatted code and documentation changes from landing on `main`. It adds two Forgejo Actions workflows: * **clang-format check** for C/C++ sources using the repository’s `.clang-format` * **markdownlint** for all `*.md` files using a repo-pinned configuration It also fixes a key mismatch by aligning `.clang-format`’s language standard with the actual project language level (C++20), and applies formatting cleanups to existing files so the new checks pass immediately. --- ### Motivation Formatting consistency was previously missed in #2/#42. Relying only on local tooling and pre-commit hooks is not sufficient; CI must provide a **hard, repeatable guardrail** so `main` remains mechanically consistent. --- ### Changes **CI** * Add `.forgejo/workflows/clang-format.yml` to verify that tracked C/C++ files match `clang-format -style=file` * Add `.forgejo/workflows/markdownlint.yml` to lint Markdown in CI **Configuration** * Update `.clang-format` to `Standard: c++20` (was `Cpp03`) * Add `.markdownlint.json` as the repository’s markdown linting policy **Pre-commit** * Add Markdown lint hook to `.pre-commit-config.yaml` (keeps local workflow consistent with CI) **Mechanical formatting fixes** * Reflow long lines in `README.md`, `docs/phase0.md`, `docs/model.md`, `docs/formatting.md` * Apply `.clang-format`-consistent formatting to core headers and test sources --- ### Notes * This is a **mechanical-only** PR. No semantic behavior or simulator logic changes are introduced. * CI enforcement is intentionally scoped to **format-only** checks: * `clang-format` for `*.{c,cc,cpp,cxx,h,hh,hpp}` * `markdownlint` for `**/*.md` * The `.clang-format` standard was updated to match the project’s compilation level (C++20), so formatting is parsed consistently with the codebase. --- ### Verification * [x] Formatting check passes locally with `clang-format -style=file` * [x] Markdown lint passes with repository config * [x] Existing CI smoke build remains unaffected
Add format check to CI (#43)
Some checks failed
ci / smoke (push) Failing after 7s
clang-format / check-format (push) Failing after 8s
markdownlint / markdown-lint (push) Successful in 10s
dd787a15be
This is needed at least for <=>.
fixup! Fix formatting (#43)
All checks were successful
ci / smoke (push) Successful in 8s
clang-format / check-format (push) Successful in 8s
markdownlint / markdown-lint (push) Successful in 11s
d3179d5b73
Add markdownlint to pre-commit (#43)
All checks were successful
ci / smoke (push) Successful in 8s
clang-format / check-format (push) Successful in 8s
markdownlint / markdown-lint (push) Successful in 10s
ci / smoke (pull_request) Successful in 8s
clang-format / check-format (pull_request) Successful in 8s
markdownlint / markdown-lint (pull_request) Successful in 11s
21b805bf65
erikinkinen added this to the Phase 0 milestone 2026-02-04 11:20:49 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
erikinkinen/AES!44
No description provided.