From 98f5f4d39c9c1cae7e8b56e2b33ee0be58e79f1d Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 2 Nov 2017 17:09:03 +0100 Subject: 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 , 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 Reviewed-by: Miklos Vajna --- solenv/clang-format/generate-style-blacklist.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 solenv/clang-format/generate-style-blacklist.sh (limited to 'solenv') 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: -- cgit