summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-15 16:58:27 -0700
committerirungentoo <irungentoo@gmail.com>2013-08-15 16:58:27 -0700
commit0a00c5c29143b2613a512c5ff3f5f6c1e390f1ac (patch)
tree8b0a059cf26481bcfdcf00ba41707787a8ee42b0 /tools
parent75873e31db5a881cdd0caf408c192e91b1901149 (diff)
parentd0098efa958ca82dc9c65c93b5830d727422faef (diff)
Merge pull request #457 from aaboagye/master
core,nTox,toxic - Fix for Issue #453. Begin refactoring w/astyle.
Diffstat (limited to 'tools')
-rw-r--r--tools/README9
-rw-r--r--tools/astylerc11
-rw-r--r--tools/pre-commit17
3 files changed, 37 insertions, 0 deletions
diff --git a/tools/README b/tools/README
new file mode 100644
index 00000000..4d8538c3
--- /dev/null
+++ b/tools/README
@@ -0,0 +1,9 @@
1This directory can house various tools and utilities.
2
3astylerc
4 - This file can be used in the precommit hook to try its best at making the code conform to the coding style document.
5
6pre-commit (*NIX only at the moment)
7 - Lints your file in adherence to the coding style doucment as best as possible in terms of spacing, indenting, etc.
8 - Requires you to have astyle installed.
9 - To use, copy this file to ProjectTox-Core/.git/hooks
diff --git a/tools/astylerc b/tools/astylerc
new file mode 100644
index 00000000..a2f05160
--- /dev/null
+++ b/tools/astylerc
@@ -0,0 +1,11 @@
1--style=kr
2--pad-header
3--max-code-length=120
4--convert-tabs
5--indent-switches
6--pad-oper
7--align-pointer=name
8--align-reference=name
9--preserve-date
10--lineend=linux
11--break-blocks \ No newline at end of file
diff --git a/tools/pre-commit b/tools/pre-commit
new file mode 100644
index 00000000..8f91779d
--- /dev/null
+++ b/tools/pre-commit
@@ -0,0 +1,17 @@
1#!/usr/bin/env sh
2#
3# An example hook script to verify what is about to be committed.
4# Called by "git commit" with no arguments. The hook should
5# exit with non-zero status after issuing an appropriate message if
6# it wants to stop the commit.
7#
8# To enable this hook, rename this file to "pre-commit".
9
10for file in `git diff-index --diff-filter=ACMR --name-only HEAD`; do
11 if [[ $file == *.c || $file == *.h ]]
12 then
13 echo $file
14 `which astyle` $file --options=tools/astylerc
15 git add $file
16 fi
17done \ No newline at end of file