1 FILES=`find client common menu server warpzonelib -name \*.c -o -name \*.h -o -name \*.qc -o -name \*.qh`
8 printf "%-40s = %-8s # %s\n" "$KEY" "$VAL" "$COMMENT"
13 verybestscore=2147483647
17 secondbestscore=2147483647
23 for choice in "$VAL" "$@"; do
32 if [ x"$choice" = x"force" ]; then
35 if [ x"$choice" = x"ignore" ]; then
38 if [ x"$choice" = x"false" ]; then
41 if [ x"$choice" = x"0" ]; then
44 if [ x"$MODE" = x"initialize" ]; then
45 if [ x"$choice" = x"ignore" ]; then
53 printf "%s = %s\n" "$KEY" "$choice"
54 } > uncrustify.cfg.test
55 UNCRUSTIFY_CONFIG=uncrustify.cfg.test sh uncrustify.sh $FILES >/dev/null 2>&1
57 if [ $status -gt 1 ]; then
58 echo "# ERROR: $KEY = $choice crashes with status $status."
62 git diff --numstat > diffstat.tmp
63 while read -r add del rest; do
64 if [ x"$add" != x"-" ]; then
65 score=$(($score + $add))
67 if [ x"$del" != x"-" ]; then
68 score=$(($score + $del))
71 git reset --hard >/dev/null 2>&1
73 echo >&2 "$KEY = $choice: $score"
74 if [ x"$choice" != x"ignore" ]; then
75 if [ $score -lt $bestscore ]; then
76 secondbestscore=$bestscore
77 secondbestchoice=$bestchoice
80 elif [ $score -lt $secondbestscore ]; then
81 secondbestscore=$score
82 secondbestchoice=$choice
85 if [ $score -lt $verybestscore ]; then
87 verybestchoice=$choice
89 if [ $score -gt $worstscore ]; then
94 if [ -z "$bestchoice" ]; then
95 echo "# WARNING: No best choice identified"
96 elif [ $verybestscore -ge $worstscore ]; then
97 echo "# WARNING: Code doesn't seem to use this feature - delete from the config?"
100 elif $havefalse; then
105 elif [ $bestscore -ge $worstscore ]; then
106 echo "# WARNING: Indifferent... please decide manually."
107 elif [ $bestscore -ge $secondbestscore ]; then
108 echo "# WARNING: Best is not unique ($bestchoice $secondbestchoice)"
109 elif [ $bestscore -gt $verybestscore ]; then
110 echo "# NOTE: is $(($bestscore - $verybestscore)) worse than $verybestchoice"
116 while read -r LINE; do
131 *"#force"*|*"#ignore"*)
136 printf "%s\n" "$LINE" | while read KEY EQ VAL DELIM COMMENT; do
138 [ x"$EQ" != x"=" ] || \
139 [ x"$DELIM" != x"#" ]; then
146 indent_columns|*tab*)
150 decide 0 1 2 3 indent_columns
156 printf "# WARNING: unsupported %s\n" "$COMMENT"
160 printf "# ERROR: invalid characters %s\n" "$COMMENT"
164 decide `echo "$COMMENT" | tr / ' '`
168 printf "# ERROR: only once choice %s\n" "$COMMENT"
173 done < uncrustify.cfg