Skip to content

Add pre-commit config and CI check - #167

Open
jeanbez wants to merge 1 commit into
developfrom
precommit-config
Open

Add pre-commit config and CI check#167
jeanbez wants to merge 1 commit into
developfrom
precommit-config

Conversation

@jeanbez

@jeanbez jeanbez commented Jul 30, 2026

Copy link
Copy Markdown
Member

Wave D item 21. Wires up pre-commit so contributors catch formatting drift and basic sanity errors before pushing, and CI enforces the same set.

Summary

  • `.pre-commit-config.yaml` at repo root.
  • `.github/workflows/pre-commit.yml` runs `pre-commit run --all-files` on every PR and on pushes to develop/master.

Hooks (h5bench-owned code only; vendored `amrex`/`e3sm`/`macsio`/`openpmd` excluded via top-level `exclude:`):

  • `check-yaml`, `check-json`, `check-merge-conflict`, `check-added-large-files`
  • `clang-format` pinned to v10 to match the existing `clang-format-check.yml` workflow.
  • `flake8` scoped to `src/*.py`, using `tox.ini`, to match the existing `lint.yml` workflow.

`trailing-whitespace` and `end-of-file-fixer` are intentionally out of scope for this PR: the tree has ~90 files with trailing whitespace and ~62 missing a final newline that would need a separate cleanup sweep first. Track as a follow-up.

Local usage

```
pip install pre-commit
pre-commit install
pre-commit run --all-files
```

Test plan

  • `pre-commit run --all-files` passes locally on a clean develop checkout.
  • The new `pre-commit` CI job passes on this PR.
  • The existing `clang-format Check` and `Python Lint` jobs are unchanged.

Wires up a local + CI pre-commit runner so contributors can catch
formatting drift and basic sanity errors before pushing.

Hooks (h5bench-owned code only; vendored amrex/e3sm/macsio/openpmd
are excluded):
  * check-yaml, check-json, check-merge-conflict, check-added-large-files
  * clang-format v10 to match the existing clang-format-check workflow's
    scope and version
  * flake8 scoped to src/*.py to match the existing lint.yml

trailing-whitespace and end-of-file-fixer are intentionally NOT added
in this PR. The tree has ~90 files with trailing whitespace and ~62
without a final newline (workflows, dockerfiles, README, docs); a
separate cleanup sweep can add those hooks after fixing the tree in
one go, so this PR stays focused.

Local usage:
  pip install pre-commit
  pre-commit install
  pre-commit run --all-files
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.85%. Comparing base (94f11ed) to head (794d3be).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #167   +/-   ##
========================================
  Coverage    58.85%   58.85%           
========================================
  Files           14       14           
  Lines         6062     6062           
  Branches      1427     1427           
========================================
  Hits          3568     3568           
  Misses        1917     1917           
  Partials       577      577           
Flag Coverage Δ
c 58.85% <ø> (ø)
python 58.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeanbez
jeanbez marked this pull request as ready for review August 22, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant