Ver Fonte

Add DEVELOPMENT.md.

parazyd há 4 anos atrás
pai
commit
79214829fc
1 ficheiros alterados com 24 adições e 0 exclusões
  1. 24 0
      DEVELOPMENT.md

+ 24 - 0
DEVELOPMENT.md

@@ -0,0 +1,24 @@
+Notes for developers
+====================
+
+## `cargo fmt` pre-commit hook
+
+To ensure every contributor uses the same code style, make sure
+you run `cargo fmt` before committing. You can force yourself to do
+this by creating a git `pre-commit` hook like the following:
+
+```
+#!/bin/bash
+diff="$(cargo fmt -- --check)
+result=$?
+
+if [[ "$result" -ne 0 ]]; then
+    echo "There are some code style issues. Run 'cargo fmt' to fix it."
+    exit 1
+fi
+
+exit 0
+```
+
+Place this script in `.git/hooks/pre-commit` and make sure it's
+executable by running `chmod +x .git/hooks/pre-commit`.