-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add CONTRIBUTING.md, pre-commit hook
- Loading branch information
1 parent
8e6650e
commit 4ef319f
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` | ||
|