Merge "Fix crashes in various GParamSpec creation functions" into tizen
[platform/upstream/glib.git] / .gitlab-ci / run-style-check-diff.sh
1 #!/bin/bash
2
3 set -e
4
5 ancestor_horizon=28  # days (4 weeks)
6
7 # Wrap everything in a subshell so we can propagate the exit status.
8 (
9
10 source .gitlab-ci/search-common-ancestor.sh
11
12 git diff -U0 --no-color "${newest_common_ancestor_sha}" | .gitlab-ci/clang-format-diff.py -binary "clang-format-11" -p1
13
14 )
15 exit_status=$?
16
17 # The style check is not infallible. The clang-format configuration cannot
18 # perfectly describe GLib’s coding style: in particular, it cannot align
19 # function arguments. The documented coding style for GLib takes priority over
20 # clang-format suggestions. Hopefully we can eventually improve clang-format to
21 # be configurable enough for our coding style. That’s why this CI check is OK
22 # to fail: the idea is that people can look through the output and ignore it if
23 # it’s wrong. (That situation can also happen if someone touches pre-existing
24 # badly formatted code and it doesn’t make sense to tidy up the wider coding
25 # style with the changes they’re making.)
26 echo ""
27 echo "Note that clang-format output is advisory and cannot always match the GLib coding style, documented at"
28 echo "   https://gitlab.gnome.org/GNOME/gtk/blob/HEAD/docs/CODING-STYLE.md"
29 echo "Warnings from this tool can be ignored in favour of the documented coding style,"
30 echo "or in favour of matching the style of existing surrounding code."
31
32 exit ${exit_status}