diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-02 17:09:03 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-03 09:29:11 +0100 |
commit | 98f5f4d39c9c1cae7e8b56e2b33ee0be58e79f1d (patch) | |
tree | ffcaf204c4c934058abd3824ee6795cdf2e2f125 /solenv | |
parent | cd592cca271cdf5eabe2aba3479e4831ef3e14a6 (diff) |
Enforce coding style with clang-format for new code
- The actual blacklist has to be generated with
solenv/clang-format/generate-style-blacklist.sh in a separate commit.
- .clang-format is from
<https://lists.freedesktop.org/archives/libreoffice/2014-August/062802.html>,
except:
- the commented out lines are removed
- Standard is Cpp11 instead of Cpp03
- explicitly avoid sorting includes (requested during ESC meeting
2017-10-11)
- no indentation inside namespaces (lots of existing code in sc wants this)
- The git hooks prints a diff when the style is violated, along with a
command to fix up the violation automatically. It also enforces style
only in new files and ignores all files listed in the blacklist.
- To avoid introducing one more hard-to-setup build dependency for new
developers, help them two ways:
- if clang-format is not installed, provide pre-built binaries for
Linux/Windows/macOS
- download/install of these binaries are printed as cmdline
instructions, similar to how we have our own 'make' on Windows
- As per ESC call 2017-11-02, currently don't do any checks if
clang-format is not installed (as a first step).
Change-Id: Iaa139c396337e8734aa1853305d808438260c41a
Reviewed-on: https://gerrit.libreoffice.org/43736
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'solenv')
-rwxr-xr-x | solenv/clang-format/generate-style-blacklist.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/solenv/clang-format/generate-style-blacklist.sh b/solenv/clang-format/generate-style-blacklist.sh new file mode 100755 index 000000000000..bd55bff76ea4 --- /dev/null +++ b/solenv/clang-format/generate-style-blacklist.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Generates a blacklist containing all existing cxx/hxx files. + +git ls-files |egrep '\.(c|cpp|cxx|h|hxx|inl)$' > solenv/clang-format/blacklist + +# vi:set shiftwidth=4 expandtab: |