Skip to content

galacticusorg/gitHooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitHooks

Scripts used by git-hooks in Galacticus repos.

commit-msg

The commit-msg hook enforces Conventional Commit format.

pre-commit

The pre-commit hook is a dispatcher that runs every executable file in the pre-commit.d/ directory in lexical order, aborting the commit if any of them fails. To add a new check, drop an executable script into pre-commit.d/ (using a numeric prefix to control ordering).

The following scripts ship in pre-commit.d/:

00-galacticus

Runs a number of checks on staged files:

  • Fortran static analysis (e.g. empty constructors/destructors, duplicate variables in constructorAssign directives);
  • bibliography (.bib) file validation;
  • spell checking of LaTeX content;
  • Python script compilation (.py);
  • XML/XSD well-formedness, plus a check for non-ASCII characters;
  • YAML linting (.yml, when yamllint is available);
  • compilation of Galacticus embedded XML and LaTeX fragments;
  • detection of leftover debugging statements (e.g. AJB HACK) in Perl, Fortran, and C/C++ sources.

01-claude-review

Reviews the staged diff with claude and blocks the commit if it finds serious issues (obvious bugs, leftover debug code, committed secrets, merge-conflict markers, or large blocks of commented-out code). Skipped silently if claude is not installed. Set SKIP_CLAUDE=1 to bypass, or CLAUDE_HOOK_MAX_LINES to change the diff-size cutoff (default 1500 lines).

prepare-commit-msg

The prepare-commit-msg hook pre-fills the commit message with a Conventional-Commits-formatted suggestion generated by claude from the staged diff. The original (empty) message is preserved below a marker line so it can be edited or replaced. Skipped silently if claude is not installed, if a message was already supplied (e.g. via -m, -t, merge, squash, or amend), or if the diff exceeds CLAUDE_MSG_MAX_LINES (default 2000). Set SKIP_CLAUDE=1 to bypass.

pre-push

The pre-push makes you confirm if you really, really want to push directly to the master|main branch - think twice before you do.....

License

Released under the MIT License.

About

Scripts used by git-hooks in Galacticus repos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors