Development¶
Git workflow¶
We use a fork-based workflow. The steps are:
- Fork ShipSoft/aegir on GitHub.
-
Clone your fork locally:
-
Add the official repository as a remote:
-
Keep your fork up to date:
-
Create a branch for your work:
-
Push and open a pull request:
Then open a PR from your fork to
ShipSoft/aegiron GitHub.
Commit messages¶
- Write a short (< 72 characters) summary on the first line.
- Optionally add a blank line followed by a more detailed explanation.
- Code must at least compile before you open a PR.
See also the commit conventions.
The commit will be used to automatically generate the changelog for all projects of the new software framework, including aegir, such that the commit conventions will be strictly enforced. Comments using the chore scope are excluded from the CHANGELOG.md by default.
Hooks and linting¶
aegir uses prek hooks, with the tools taken
from the pixi lint environment. Install them once per clone:
This sets up a pre-commit hook for formatting and linting, and a commit-msg
hook that checks the Conventional Commits format. Run all hooks by hand with
pixi run lint.
C++ is also checked with clang-tidy. CI reports findings only on the lines a
PR changes. Check your changes locally with pixi run clang-tidy-diff. After
editing a header, run pixi run clang-tidy on the whole tree, because the
diff task cannot see header-only changes.
See Linting & git hooks for the setup shared by all SHiP repositories, and CONTRIBUTING.md for the full contribution rules.
C++ guidelines¶
See also the C++ Core Guidelines.
General¶
- NEVER use
using namespacein headers. - Prefer
static_cast,dynamic_cast, orreinterpret_castover C-style casts. - Prefer range-based for loops.
- Prefer STL containers over ROOT containers.
- Prefer smart pointers over raw pointers.
- Consider using
autoto reduce type verbosity.
Python guidelines¶
See also the Google Python Style Guide.
General¶
- ALWAYS use
ruff format(for new code) andruff check. - ALWAYS place import statements at the top of the file.
- NEVER run non-trivial code at module top-level scope; hide it behind
if __name__ == "__main__":. - Prefer iterating over containers to manual indexing.
- Prefer
argparseovergetopt. - Use f-strings or
str.format()rather than%-formatting.