|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `src/`: Fortran library sources (e.g., `backends/`, `figures/`, `utilities/`). |
| 5 | +- `test/`: FPM tests (`test_*.f90`) and artifacts under `test/output/`. |
| 6 | +- `example/`: Fortran and Python examples; generated media in `output/example/...`. |
| 7 | +- `python/fortplot/`: Python wrapper and helpers (`core.py`, `axes.py`, etc.). |
| 8 | +- `cmake/`, `Makefile`, `fpm.toml`: Build systems; docs in `doc/`, FORD config in `doc.md`. |
| 9 | + |
| 10 | +## Build, Test, and Development Commands |
| 11 | +- Build (FPM): `make build` or `fpm build`. |
| 12 | +- Run examples: `make example` (Fortran), `make example_python`, `make example_matplotlib`. |
| 13 | +- Debug apps: `make debug` or `fpm run --target <app>`. |
| 14 | +- Tests: `make test` or `fpm test`; CI-fast set: `make test-ci`. |
| 15 | +- Coverage: `make coverage` (gcov/gcovr; results in `coverage.txt`). |
| 16 | +- Docs: `make doc` (FORD → `build/doc/index.html`). |
| 17 | +- Clean: `make clean`. |
| 18 | + Examples: `make test ARGS="--target test_public_api"`, `make example ARGS="basic_plots"`. |
| 19 | + |
| 20 | +## Coding Style & Naming Conventions |
| 21 | +- Fortran: free-form, no implicit typing (`fpm.toml` enforces), prefer `use fortplot, only: wp => real64`. |
| 22 | +- Indentation: spaces, keep modules under ~1000 lines; group by subfolders (`backends/`, `figures/`). |
| 23 | +- Names: tests `test_*.f90`; procedures snake_case; modules end with `_t` for derived types (e.g., `figure_t`). |
| 24 | +- Python: follow PEP 8; modules split into focused files (`core.py`, `axes.py`, `advanced.py`). |
| 25 | +- Tooling: pre-commit for whitespace/EOF/YAML/TOML checks (`.pre-commit-config.yaml`). |
| 26 | + |
| 27 | +## Testing Guidelines |
| 28 | +- Framework: FPM auto-discovers tests in `test/`. Name new tests `test_<topic>.f90` and keep output in `build/test/output/`. |
| 29 | +- Run subsets: `fpm test --target <name>`. |
| 30 | +- Env controls: `FORTPLOT_SUPPRESS_WARNINGS=1 make test` (quiet), `FORTPLOT_FORCE_WARNINGS=1 make test`. |
| 31 | +- Coverage: prefer `make coverage` before submitting significant changes. |
| 32 | + |
| 33 | +## Commit & Pull Request Guidelines |
| 34 | +- Commits: Conventional Commits style (`feat:`, `fix:`, `docs:`, `refactor:`, `cleanup:`). Example: `fix: resolve pcolormesh dimension validation (#600)`. |
| 35 | +- PRs: concise description, link issues, list user-facing changes, include before/after images for rendering changes, and note test targets run (e.g., `test-ci`). |
| 36 | + |
| 37 | +## Security & Configuration Tips |
| 38 | +- Animations require `ffmpeg` (optional). Verify with `ffprobe` if needed. |
| 39 | +- Hardened builds: trampoline checks via `fpm build --flag "-Wtrampolines -Werror=trampolines"`. |
| 40 | +- Verification: `make verify-functionality`, `make verify-size-compliance` for artifact integrity. |
0 commit comments