summaryrefslogtreecommitdiff
path: root/data/run-uncrustify.sh
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-04-18 18:57:12 +0200
committerCarlos Soriano <csoriano@gnome.org>2016-08-29 18:37:10 +0200
commit4cafccd82859a4ee0bdfad3e31a310f2d94c0485 (patch)
treeacbe559b7fb4ff501e3fb1c3ef17eac6c84bf71e /data/run-uncrustify.sh
parenta8c24d0f893d5911f0e978c18117a16410ec77fa (diff)
downloadnautilus-4cafccd82859a4ee0bdfad3e31a310f2d94c0485.tar.gz
general: add uncrustify script
The current style of nautilus is rather poor and mixes at least 3 different code styles. Specific issues that affect the most common contributors to Nautilus performance are: - tabs for multiline alignment. - mix of tabs and spaces. - errors on no braced one liners conditionals. - errors on non braced case statements with variable declarations. So I would say requirements for the style is to address the previous issues and also be a well known style. I don't want new contributors to see a new style completely different from C books authors. So far, I found Allman (aka BSD) style which seems the choice of most C books authors as far as I can see on internet, and it address the previous mentioned issues. Since uncrustify doesn't support the aligment of parameters we do for multiple stars "**", we also added a script made by Sebastian Wilmet to align those. As a matter of practicity I'm going to convert all Nautilus style to this one, and if the next person who contributes most on Nautilus has a different choice, please feel free to change it to whatever makes your performance and your contributors performance the best. https://bugzilla.gnome.org/show_bug.cgi?id=770564
Diffstat (limited to 'data/run-uncrustify.sh')
-rwxr-xr-xdata/run-uncrustify.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/data/run-uncrustify.sh b/data/run-uncrustify.sh
new file mode 100755
index 000000000..3114f557d
--- /dev/null
+++ b/data/run-uncrustify.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+if [ -x "lineup-parameters" ];
+then
+ for DIR in ../src ../nautilus-desktop ../test ../libnautilus-extension ../eel ../nautilus-sendto-extension
+ do
+ for FILE in $(find $DIR -name "*.c")
+ do
+ # Aligning prototypes is not working yet, so avoid headers
+ uncrustify -c uncrustify.cfg --no-backup $FILE
+ ./lineup-parameters $FILE > $FILE.temp && mv $FILE.temp $FILE
+ done
+ done
+else
+ echo "Script lineup-parameters does not exists here in (source directory)/data, probably because Nautilus was built in a different directory than the source directory.
+Copy the program in the (build directory)/data/lineup-parameters here in (source directory)/data and run again run-uncrustify.sh."
+fi