diff options
author | ng0 <ng0@n0.is> | 2019-11-21 10:50:02 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-11-21 10:50:02 +0000 |
commit | d31342702e4128aac7dc9c3ac85f856868fbd479 (patch) | |
tree | d99d52151bb277da551f256948f81f2f6597b0cd /contrib/conf | |
parent | 897c000d985704972918d9943332645e8feb329d (diff) | |
download | gnunet-d31342702e4128aac7dc9c3ac85f856868fbd479.tar.gz gnunet-d31342702e4128aac7dc9c3ac85f856868fbd479.zip |
move configs in contrib to conf
Diffstat (limited to 'contrib/conf')
-rw-r--r-- | contrib/conf/tox.ini | 4 | ||||
-rw-r--r-- | contrib/conf/uncrustify.cfg | 95 | ||||
-rwxr-xr-x | contrib/conf/uncrustify_precommit | 35 |
3 files changed, 134 insertions, 0 deletions
diff --git a/contrib/conf/tox.ini b/contrib/conf/tox.ini new file mode 100644 index 000000000..aee00e3b7 --- /dev/null +++ b/contrib/conf/tox.ini | |||
@@ -0,0 +1,4 @@ | |||
1 | [flake8] | ||
2 | max-line-length = 160 | ||
3 | exclude = .git *.bak | ||
4 | filename = *.py* \ No newline at end of file | ||
diff --git a/contrib/conf/uncrustify.cfg b/contrib/conf/uncrustify.cfg new file mode 100644 index 000000000..8c9df2c43 --- /dev/null +++ b/contrib/conf/uncrustify.cfg | |||
@@ -0,0 +1,95 @@ | |||
1 | input_tab_size = 2 | ||
2 | output_tab_size = 2 | ||
3 | |||
4 | indent_columns = 2 | ||
5 | indent_with_tabs = 0 | ||
6 | indent_case_brace = 2 | ||
7 | indent_label=-16 | ||
8 | |||
9 | code_width=80 | ||
10 | #cmd_width=80 | ||
11 | |||
12 | # Leave most comments alone for now | ||
13 | cmt_indent_multi=false | ||
14 | sp_cmt_cpp_start=add | ||
15 | |||
16 | sp_not=add | ||
17 | |||
18 | sp_func_call_user_paren_paren=remove | ||
19 | sp_inside_fparen=remove | ||
20 | sp_after_cast=add | ||
21 | |||
22 | ls_for_split_full=true | ||
23 | ls_func_split_full=true | ||
24 | ls_code_width=true | ||
25 | |||
26 | # Arithmetic operations in wrapped expressions should be at the start | ||
27 | # of the line. | ||
28 | pos_arith=lead | ||
29 | |||
30 | # Fully parenthesize boolean exprs | ||
31 | mod_full_paren_if_bool=true | ||
32 | |||
33 | # Braces should be on their own line | ||
34 | nl_fdef_brace=add | ||
35 | nl_enum_brace=add | ||
36 | nl_struct_brace=add | ||
37 | nl_union_brace=add | ||
38 | nl_if_brace=add | ||
39 | nl_brace_else=add | ||
40 | nl_elseif_brace=add | ||
41 | nl_while_brace=add | ||
42 | nl_switch_brace=add | ||
43 | |||
44 | # no newline between "else" and "if" | ||
45 | nl_else_if=remove | ||
46 | |||
47 | nl_func_paren=remove | ||
48 | nl_assign_brace=remove | ||
49 | |||
50 | # No extra newlines that cause noisy diffs | ||
51 | nl_start_of_file=remove | ||
52 | nl_after_func_proto = 2 | ||
53 | nl_after_func_body = 3 | ||
54 | # If there's no new line, it's not a text file! | ||
55 | nl_end_of_file=add | ||
56 | nl_max_blank_in_func = 3 | ||
57 | nl_max = 3 | ||
58 | |||
59 | sp_inside_paren = remove | ||
60 | |||
61 | sp_arith = add | ||
62 | sp_arith_additive = add | ||
63 | |||
64 | # We want spaces before and after "=" | ||
65 | sp_before_assign = add | ||
66 | sp_after_assign = add | ||
67 | |||
68 | # we want "char *foo;" | ||
69 | sp_after_ptr_star = remove | ||
70 | sp_between_ptr_star = remove | ||
71 | |||
72 | # we want "if (foo) { ... }" | ||
73 | sp_before_sparen = add | ||
74 | |||
75 | sp_inside_fparen = remove | ||
76 | sp_inside_sparen = remove | ||
77 | |||
78 | # add space before function call and decl: "foo (x)" | ||
79 | sp_func_call_paren = add | ||
80 | sp_func_proto_paren = add | ||
81 | sp_func_proto_paren_empty = add | ||
82 | sp_func_def_paren = add | ||
83 | sp_func_def_paren_empty = add | ||
84 | |||
85 | # We'd want it for "if ( (foo) || (bar) )", but not for "if (m())", | ||
86 | # so as uncrustify doesn't give exactly what we want => ignore | ||
87 | sp_paren_paren = ignore | ||
88 | sp_inside_paren = remove | ||
89 | sp_bool = force | ||
90 | |||
91 | nl_func_type_name = force | ||
92 | #nl_branch_else = add | ||
93 | nl_else_brace = add | ||
94 | nl_elseif_brace = add | ||
95 | nl_for_brace = add | ||
diff --git a/contrib/conf/uncrustify_precommit b/contrib/conf/uncrustify_precommit new file mode 100755 index 000000000..fd29998c3 --- /dev/null +++ b/contrib/conf/uncrustify_precommit | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # use as .git/hooks/pre-commit | ||
4 | |||
5 | exec 1>&2 | ||
6 | |||
7 | RET=0 | ||
8 | changed=$(git diff --cached --name-only) | ||
9 | crustified="" | ||
10 | |||
11 | for f in $changed; | ||
12 | do | ||
13 | if echo $f | grep \\.[c,h]\$ > /dev/null | ||
14 | then | ||
15 | # compare result of uncrustify with changes | ||
16 | # | ||
17 | # only change any of the invocations here if | ||
18 | # they are portable across all cmp and shell | ||
19 | # implementations ! | ||
20 | uncrustify -q -c uncrustify.cfg -f $f | cmp -s $f - | ||
21 | if test $? = 1 ; | ||
22 | then | ||
23 | crustified=" $crustified $f" | ||
24 | RET=1 | ||
25 | fi | ||
26 | fi | ||
27 | done | ||
28 | |||
29 | if [ $RET = 1 ]; | ||
30 | then | ||
31 | echo "Run" | ||
32 | echo "uncrustify --no-backup -c uncrustify.cfg ${crustified}" | ||
33 | echo "before commiting." | ||
34 | fi | ||
35 | exit $RET | ||