Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Add guidelines about formatting lambdas in Krita's source tree

Dmitry Kazakov442f669f2538
diff --git a/.clang-format b/.clang-format
index 0c76379203..4b870ca86a 100644
--- a/.clang-format
+++ b/.clang-format
@@ -77,6 +77,10 @@ KeepEmptyLinesAtTheStartOfBlocks: false
# no namespace indentation to keep indent level low
NamespaceIndentation: None
+# Automatically add a comment with the namespace name at the closing
+# bracket of the namespace
+FixNamespaceComments: true
+
# we use template< without space.
SpaceAfterTemplateKeyword: false
@@ -89,6 +93,9 @@ ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMA
# keep lambda formatting multi-line if not empty
AllowShortLambdasOnASingleLine: Empty
+# Align limbdas against their signature lines
+LambdaBodyIndentation: Signature
+
# We do not want clang-format to put all arguments on a new line
AllowAllArgumentsOnNextLine: false
diff --git a/HACKING b/HACKING
index cdc6cce0a3..379c5c7b4d 100644
--- a/HACKING
+++ b/HACKING
@@ -57,6 +57,20 @@ Indentation
With four spaces. Use the default kdelibs indentation
(http://techbase.kde.org/Policies/Kdelibs_Coding_Style)
+Indentation of Lambdas
+
+ For indentation of lambdas refer to the `LambdaBodyIndentation: Signature` method used
+ by clang-format, i.e. "align lambda body relative to the lambda signature"
+
+ someMethod(
+ [](SomeReallyLongLambdaSignatureArgument foo) {
+ return;
+ });
+
+ You can use automated "Format Selection" actions of QtCreator and VSCode to format
+ lambdas. They will user the necessary settings from .clang-format file present in
+ the Krita's source tree.
+
Includes
Avoid as much as possible #includes in header files; use forward declarations