From 79bf4f3b5ae3c379e8f1b2a97b2f254196d222f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Tue, 15 Jul 2014 11:10:49 +0200 Subject: [PATCH] Add calamaresstyle script --- HACKING.md | 4 ++++ hacking/astylerc | 13 +++++++++++++ hacking/calamaresstyle | 6 ++++++ 3 files changed, 23 insertions(+) create mode 100644 hacking/astylerc create mode 100755 hacking/calamaresstyle diff --git a/HACKING.md b/HACKING.md index 0433947e2..219e6018c 100644 --- a/HACKING.md +++ b/HACKING.md @@ -43,6 +43,10 @@ MyClass::myMethod( QStringList list, const QString& name ) } ``` +You can use the `hacking/calamaresstyle` script to run +[astyle](http://astyle.sf.net) on your code and have it formatted the right +way. + Naming ------ * Use CamelCase for everything. diff --git a/hacking/astylerc b/hacking/astylerc new file mode 100644 index 000000000..043e81f0f --- /dev/null +++ b/hacking/astylerc @@ -0,0 +1,13 @@ +# Do not create a backup file +suffix=none + +indent=spaces=4 + +# Brackets +style=break +remove-brackets # Remove brackets on single-line `if` and `for` (requires astyle 2.04) + +# Spaces +pad-paren-in +pad-header +align-pointer=type diff --git a/hacking/calamaresstyle b/hacking/calamaresstyle new file mode 100755 index 000000000..2bb9b2578 --- /dev/null +++ b/hacking/calamaresstyle @@ -0,0 +1,6 @@ +#!/bin/sh +# Calls astyle with settings matching Calamares coding style +# Requires astyle >= 2.04 +set -e + +astyle --options=$(dirname $0)/astylerc "$@"