From 7be077e3e341d3fcb177aa67570ff090b74344f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Mon, 1 Apr 2019 22:03:32 +0200 Subject: [PATCH] [clang-format] Move .clang-format to .clang-format.optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should stop editors/IDEs blindly auto-formatting existing code and thereby resulting in unreadable diffs. Signed-off-by: Dan Čermák (cherry picked from commit d8e062ee709d999375239b3a6eb38cc692b4bc76) --- .clang-format => .clang-format.optional | 0 CODING_GUIDELINES.md | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) rename .clang-format => .clang-format.optional (100%) diff --git a/.clang-format b/.clang-format.optional similarity index 100% rename from .clang-format rename to .clang-format.optional diff --git a/CODING_GUIDELINES.md b/CODING_GUIDELINES.md index 5bb3d55a..1f1ce3c6 100644 --- a/CODING_GUIDELINES.md +++ b/CODING_GUIDELINES.md @@ -28,14 +28,16 @@ If in doubt, then use the fixed size integer types like `int32_t`, `uint64_t`, ` # 3. Code Formatting # -The project contains a `.clang-format` file defining the code formatting of the project (more details about of this file was defined can be found in this [PR](https://github.com/Exiv2/exiv2/pull/152)). We suggest you to respect the code formatting by applying `clang-format` to new or existing code. You can do it by using the `clang-format` command-line tool, or by using some integration plugins provided by some editors or IDEs. Currently we know about these integrations: +The project contains a `.clang-format.optional` file defining the code formatting of the project (more details about of this file was defined can be found in this [PR](https://github.com/Exiv2/exiv2/pull/152)). We do not provide it via the standard name (`.clang-format`), since we do not enforce code formatting and do not want editors to automatically format everything. + +Nevertheless, we suggest you to respect the code formatting by symlinking `.clang-format.optional` to `.clang-format` and applying `clang-format` to new or existing code. You can do it by using the `clang-format` command-line tool or by using one of the integration plugins provided by various editors or IDEs. Currently we know about these integrations: - [QtCreator](http://doc.qt.io/qtcreator/creator-beautifier.html) -> beautifier -> clang-format - [vim-clang-format](https://github.com/rhysd/vim-clang-format) - [Emacs](https://clang.llvm.org/docs/ClangFormat.html#emacs-integration) - Visual Studio: [1](http://clang.llvm.org/docs/ClangFormat.html#visual-studio-integration), [2](https://marketplace.visualstudio.com/items?itemName=xaver.clang-format) -Note that some times, the formatting applied to some complex code might result in some unexpected output. If you know how to improve the current `.clang-format` file to deal with such cases, then please contribute!. Otherwise, you have two options: +Note that some times the formatting applied to complex code might result in some unexpected output. If you know how to improve the current `.clang-format` file to deal with such cases, then please contribute!. Otherwise, you have two options: 1. Apply `clang-format` to individual blocks of code (avoid to apply it over the complex piece of code). 2. Indicate which parts of the code that should not be `clang-format` formatted: