Skip to content

Commit

Permalink
add CONTRIBUTING.md, pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
PikalaxALT committed Jul 7, 2024
1 parent 8e6650e commit 4ef319f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
# Redirect output to stderr.
exec 1>&2

# Run clang-format on staged files; abort the commit if any files are changed
if ! git clang-format ; then
echo "linting made changes to source files; aborting commit"
exit 1
fi
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributing to pret/pokeheartgold

<!--toc:start-->
- [Code Formatting](#code-formatting)
<!--toc:end-->

This document provides a synopsis and loose guidelines for how to contribute to this project. It is a work in progress. Maintainers should expand this document.

## Code Formatting

This repository includes an opinionated `clang-format` specification to ensure that we maintain a common code style. For convenience, a pre-commit hook is also provided in `.githooks` which will run `clang-format` against any staged changes prior to executing a commit.

### Requirements

- `clang-format@17` or newer

### Usage

To set up the pre-commit hook:

```sh
git config --local core.hooksPath .githooks/
```

To run the formatter on the full source tree:

```bash
./format.sh
```

0 comments on commit 4ef319f

Please sign in to comment.