From 581722d41f566ba87ed716484d73c22ea8586d87 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Fri, 18 Jan 2019 13:37:30 +0100 Subject: [PATCH 01/27] Sync .clang-format to AliceO2 & QualityControl --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 86f1ae5..d92c9c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ after_success: | set -e curl -L https://github.com/github/hub/releases/download/v2.6.0/hub-linux-amd64-2.6.0.tgz | tar xz MESSAGE="Align Clang Format to upstream" - REPOS=Common + REPOS="Common AliceO2 QualityControl" ORG=${TRAVIS_REPO_SLUG%%/*} for REPO in $REPOS; do git clone git://github.com/$ORG/$REPO From 9771a15f2b3157ac85a803810d960a7777549333 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Fri, 18 Jan 2019 13:47:25 +0100 Subject: [PATCH 02/27] Do not fail if we are unable to create a PR. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d92c9c0..811c16e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ after_success: | git config user.name ${TRAVIS_SECURE_USER} git add .clang-format git commit -m "${MESSAGE}" - git push "https://${TRAVIS_SECURE_TOKEN_NAME}@github.com/$ORG/$REPO" HEAD:refs/heads/coding-guidelines-update > /dev/null 2>&1 - GITHUB_TOKEN=${TRAVIS_SECURE_TOKEN_NAME} ../hub-linux-amd64-2.6.0/bin/hub pull-request -h coding-guidelines-update -b master -m "Coding Guidelines update of $(date +%Y-%m-%d)" + git push "https://${TRAVIS_SECURE_TOKEN_NAME}@github.com/$ORG/$REPO" HEAD:refs/heads/coding-guidelines-update -f > /dev/null 2>&1 + GITHUB_TOKEN=${TRAVIS_SECURE_TOKEN_NAME} ../hub-linux-amd64-2.6.0/bin/hub pull-request -h coding-guidelines-update -b master -m "Coding Guidelines update of $(date +%Y-%m-%d)" || true popd done From d77a6d4a96d01509687813d1d387b654f1a6f659 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Fri, 18 Jan 2019 13:57:08 +0100 Subject: [PATCH 03/27] Do not sync .clang-format if not required --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 811c16e..221c000 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,9 @@ after_success: | git config user.email ${TRAVIS_SECURE_EMAIL} git config user.name ${TRAVIS_SECURE_USER} git add .clang-format - git commit -m "${MESSAGE}" - git push "https://${TRAVIS_SECURE_TOKEN_NAME}@github.com/$ORG/$REPO" HEAD:refs/heads/coding-guidelines-update -f > /dev/null 2>&1 - GITHUB_TOKEN=${TRAVIS_SECURE_TOKEN_NAME} ../hub-linux-amd64-2.6.0/bin/hub pull-request -h coding-guidelines-update -b master -m "Coding Guidelines update of $(date +%Y-%m-%d)" || true + if git commit -m "${MESSAGE}"; then + git push "https://${TRAVIS_SECURE_TOKEN_NAME}@github.com/$ORG/$REPO" HEAD:refs/heads/coding-guidelines-update -f > /dev/null 2>&1 + GITHUB_TOKEN=${TRAVIS_SECURE_TOKEN_NAME} ../hub-linux-amd64-2.6.0/bin/hub pull-request -h coding-guidelines-update -b master -m "Coding Guidelines update of $(date +%Y-%m-%d)" || true + fi popd done From 8a34263a55d8ec9615acda37106ec58ccff83dfe Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Fri, 18 Jan 2019 14:03:11 +0100 Subject: [PATCH 04/27] Sync .clang-format with Monitoring --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 221c000..0cd9836 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ after_success: | set -e curl -L https://github.com/github/hub/releases/download/v2.6.0/hub-linux-amd64-2.6.0.tgz | tar xz MESSAGE="Align Clang Format to upstream" - REPOS="Common AliceO2 QualityControl" + REPOS="Common AliceO2 QualityControl Monitoring" ORG=${TRAVIS_REPO_SLUG%%/*} for REPO in $REPOS; do git clone git://github.com/$ORG/$REPO From 3c8203c33f4f995efdbaecb0840fa058136f9b3e Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Fri, 18 Jan 2019 14:07:34 +0100 Subject: [PATCH 05/27] Sync .clang-format also with InfoLogger --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0cd9836..a6a3504 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ after_success: | set -e curl -L https://github.com/github/hub/releases/download/v2.6.0/hub-linux-amd64-2.6.0.tgz | tar xz MESSAGE="Align Clang Format to upstream" - REPOS="Common AliceO2 QualityControl Monitoring" + REPOS="Common AliceO2 InfoLogger QualityControl Monitoring" ORG=${TRAVIS_REPO_SLUG%%/*} for REPO in $REPOS; do git clone git://github.com/$ORG/$REPO From 58638dad357bb182f61374d6c0e609c8323c1381 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Fri, 18 Jan 2019 14:22:09 +0100 Subject: [PATCH 06/27] Sync .clang-format to ReadoutCard --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a6a3504..59335fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ after_success: | set -e curl -L https://github.com/github/hub/releases/download/v2.6.0/hub-linux-amd64-2.6.0.tgz | tar xz MESSAGE="Align Clang Format to upstream" - REPOS="Common AliceO2 InfoLogger QualityControl Monitoring" + REPOS="Common ReadoutCard AliceO2 InfoLogger QualityControl Monitoring" ORG=${TRAVIS_REPO_SLUG%%/*} for REPO in $REPOS; do git clone git://github.com/$ORG/$REPO From 7a92707abcfaeac9d7559160d542c346ff1beaec Mon Sep 17 00:00:00 2001 From: Adam Wegrzynek Date: Wed, 23 Jan 2019 08:52:06 +0100 Subject: [PATCH 07/27] Add Readout and Configuration to the list of repos that should receive CodingGuideline updates --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 59335fc..f5f56da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ after_success: | set -e curl -L https://github.com/github/hub/releases/download/v2.6.0/hub-linux-amd64-2.6.0.tgz | tar xz MESSAGE="Align Clang Format to upstream" - REPOS="Common ReadoutCard AliceO2 InfoLogger QualityControl Monitoring" + REPOS="Common ReadoutCard AliceO2 InfoLogger QualityControl Monitoring Readout Configuration" ORG=${TRAVIS_REPO_SLUG%%/*} for REPO in $REPOS; do git clone git://github.com/$ORG/$REPO From f792c24cdb15a6ee2f372621defca4a3abdc491f Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Wed, 23 Jan 2019 09:31:35 +0100 Subject: [PATCH 08/27] .clang-format sync: do nothing if nothing changed --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 59335fc..32fe8db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,8 @@ after_success: | pushd $REPO git remote git config user.email ${TRAVIS_SECURE_EMAIL} - git config user.name ${TRAVIS_SECURE_USER} - git add .clang-format - if git commit -m "${MESSAGE}"; then + git config user.name ${TRAVIS_SECURE_USER} + if git add .clang-format && git commit -m "${MESSAGE}"; then git push "https://${TRAVIS_SECURE_TOKEN_NAME}@github.com/$ORG/$REPO" HEAD:refs/heads/coding-guidelines-update -f > /dev/null 2>&1 GITHUB_TOKEN=${TRAVIS_SECURE_TOKEN_NAME} ../hub-linux-amd64-2.6.0/bin/hub pull-request -h coding-guidelines-update -b master -m "Coding Guidelines update of $(date +%Y-%m-%d)" || true fi From 550a3b8e4e20564cf8355e7be496f74c66bbc34e Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Wed, 23 Jan 2019 09:38:12 +0100 Subject: [PATCH 09/27] Trigger travis only when branch master changes --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 32fe8db..1c94e4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,3 +20,6 @@ after_success: | fi popd done +branches: + only: + - master From f845665326d1a913d486332d24ba696fc2e86d08 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Wed, 23 Jan 2019 10:21:35 +0100 Subject: [PATCH 10/27] Check if .clang-format was modified at all. --- .travis.yml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2360541..b89b760 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,19 +7,21 @@ after_success: | MESSAGE="Align Clang Format to upstream" REPOS="Common ReadoutCard AliceO2 InfoLogger QualityControl Monitoring Readout Configuration" ORG=${TRAVIS_REPO_SLUG%%/*} - for REPO in $REPOS; do - git clone git://github.com/$ORG/$REPO - cp .clang-format $REPO - pushd $REPO - git remote - git config user.email ${TRAVIS_SECURE_EMAIL} - git config user.name ${TRAVIS_SECURE_USER} - if git add .clang-format && git commit -m "${MESSAGE}"; then - git push "https://${TRAVIS_SECURE_TOKEN_NAME}@github.com/$ORG/$REPO" HEAD:refs/heads/coding-guidelines-update -f > /dev/null 2>&1 - GITHUB_TOKEN=${TRAVIS_SECURE_TOKEN_NAME} ../hub-linux-amd64-2.6.0/bin/hub pull-request -h coding-guidelines-update -b master -m "Coding Guidelines update of $(date +%Y-%m-%d)" || true - fi - popd - done + if git diff --name-only $TRAVIS_COMMIT_RANGE | grep .clang-format ; then + for REPO in $REPOS; do + git clone git://github.com/$ORG/$REPO + cp .clang-format $REPO + pushd $REPO + git remote + git config user.email ${TRAVIS_SECURE_EMAIL} + git config user.name ${TRAVIS_SECURE_USER} + if git add .clang-format && git commit -m "${MESSAGE}"; then + git push "https://${TRAVIS_SECURE_TOKEN_NAME}@github.com/$ORG/$REPO" HEAD:refs/heads/coding-guidelines-update -f > /dev/null 2>&1 + GITHUB_TOKEN=${TRAVIS_SECURE_TOKEN_NAME} ../hub-linux-amd64-2.6.0/bin/hub pull-request -h coding-guidelines-update -b master -m "Coding Guidelines update of $(date +%Y-%m-%d)" || true + fi + popd + done + fi branches: only: - master From c42db4ca057f4cab3c667f3ca0fd16ecec916feb Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Wed, 23 Jan 2019 15:05:13 +0100 Subject: [PATCH 11/27] Sync .clang-format when .travis.yml changes --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b89b760..16c1f58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,14 @@ after_success: | MESSAGE="Align Clang Format to upstream" REPOS="Common ReadoutCard AliceO2 InfoLogger QualityControl Monitoring Readout Configuration" ORG=${TRAVIS_REPO_SLUG%%/*} - if git diff --name-only $TRAVIS_COMMIT_RANGE | grep .clang-format ; then + # We only build if the change involves .clang-format or .travis.yml. The latter + # is to make sure that when we add new repositories we resync. + if git diff --name-only $TRAVIS_COMMIT_RANGE | grep -e "\(.clang-format\|.travis.yml\)" ; then for REPO in $REPOS; do + echo Processing $REPO git clone git://github.com/$ORG/$REPO cp .clang-format $REPO pushd $REPO - git remote git config user.email ${TRAVIS_SECURE_EMAIL} git config user.name ${TRAVIS_SECURE_USER} if git add .clang-format && git commit -m "${MESSAGE}"; then From e4677411c78b18e95beeddcee7e2b40375216c22 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 28 Feb 2019 10:07:43 +0100 Subject: [PATCH 12/27] Moved the instructions for formatting from O2 to CodingGuidelines --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a637915..ba833bf 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,71 @@ Coding guidelines for the ALICE O2 project. * [Naming and formatting conventions](https://rawgit.com/AliceO2Group/CodingGuidelines/master/naming_formatting.html) * [Comments guidelines](https://rawgit.com/AliceO2Group/CodingGuidelines/master/comments_guidelines.html) -### ClangFormat +### Formatting tool +The ALICE O2 projects use `clang-format` to push for a common code formatting. The rules are defined in +the `clang-format` configuration file in this repository (which is propagated to other AliceO2Group repositories). With an adiabatic +approach, all changes have to follow the formatting rules. A script, described below, can be +used to integrate the formatting into `git` and suggest formatting only for +changed lines. + +#### Install `clang-format` and git integration + +Note : The installation of clang using aliBuild is not necessary on Mac. + +1. Build clang (to be done once) +```bash +aliBuild build --defaults o2 Clang +``` +2. Load clang and clang-format +```bash +alienv load Clang/latest +``` +3. Install git-clang-format +```bash +cd $HOME +mkdir -p bin +cd bin +wget llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format +chmod u+x git-clang-format +``` + +#### Check files' formatting +Show correctly formatted version of a file : +``` +clang-format -style=file SOURCEFILE +``` + +Directly apply the style to a file : +``` +clang-format -style=file -i SOURCEFILE +``` + +Apply the style to all the source and header files in a directory (recursive) : + +``` +find . -iname "*.h" -o -iname "*.cpp" | xargs clang-format -style=file -i +``` + +Display what needs to be fixed in a file : +``` +clang-format -style=file | diff - +``` + +#### Check commits' formatting +`git clang-format` invokes `clang-format` on the changes in current files +or a specific commit. E.g. for the last commit +``` +git clang-format HEAD~1 +``` + +Or for all commits done with respect to the remote branch state +``` +git clang-format origin/dev +``` + +#### Using an IDE +A number of config files are available [here](https://github.com/AliceO2Group/CodingGuidelines) for various IDEs. -ClangFormat can be used to format your source code. See instructions in the [AliceO2 repo README](https://github.com/AliceO2Group/AliceO2/). ### Configuration files for editors From 260f109862bdfe5963ff37287d5e72cd078e007a Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Mon, 25 Feb 2019 15:57:56 +0100 Subject: [PATCH 13/27] Only run travis on master branch changes --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 16c1f58..6f1eac5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: bash +branches: + only: + - master script: echo "Nothing to do" after_success: | From aa51e55f659931eb1bf1a8188e8d6adaa9e98aeb Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 8 Apr 2019 16:26:06 +0200 Subject: [PATCH 14/27] update coding guidelines for nested namespaces Allow C++17 style nested namespaces. --- coding_guidelines.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/coding_guidelines.html b/coding_guidelines.html index b6f9604..79720fc 100644 --- a/coding_guidelines.html +++ b/coding_guidelines.html @@ -563,7 +563,17 @@

General guideline

Example of a typical class definition within a project and sub-project namespace: -

+

+
namespace project::subproject
+{
+
+class MyClass
+{
+...
+};
+
+} // namespace subproject::project
+

Alternatively, the C++98/11/14 style for nested namespaces can be used:

namespace project
 {
 namespace subproject

From 14b25480af1bfb7dce121424b7fc3852bcbf7809 Mon Sep 17 00:00:00 2001
From: Laurent Aphecetche 
Date: Tue, 23 Apr 2019 17:38:26 +0200
Subject: [PATCH 15/27] Add a rule for executable names

---
 naming_formatting.html | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/naming_formatting.html b/naming_formatting.html
index adbc44e..5ea9f6b 100644
--- a/naming_formatting.html
+++ b/naming_formatting.html
@@ -172,7 +172,18 @@ 

ALICE O² C++ Naming & Formatting Rules

+ General Naming Rules + File Names + Executable Names + Type Names + Interface Names + Variable Names + Function Names + Namespace Names + Enumerator Names + Macro Names +
+ @@ -373,6 +384,33 @@

File Names

+
+

+ Executable Names +

+ + link + + +
+ Executable names should be in lowercase, prefixed with o2, and hyphenated : o2-tpc-reco-workflow +
+
+ +
+
+

Type Names

From 93498f630827d6e7df2f24af330f44df54278086 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Tue, 16 Jul 2019 12:30:05 +0200 Subject: [PATCH 16/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba833bf..5e0f73b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ aliBuild build --defaults o2 Clang ``` 2. Load clang and clang-format ```bash -alienv load Clang/latest +alienv enter Clang/latest ``` 3. Install git-clang-format ```bash From 13b8e8715ad3c09eb797de9077f51354426c227f Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 18 Jul 2019 12:28:34 +0200 Subject: [PATCH 17/27] Add naming rule for libraries --- naming_formatting.html | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/naming_formatting.html b/naming_formatting.html index 5ea9f6b..269ede9 100644 --- a/naming_formatting.html +++ b/naming_formatting.html @@ -175,6 +175,7 @@

ALICE O² C++ Naming & Formatting Rules

General Naming Rules
File Names Executable Names + Library Names Type Names Interface Names Variable Names @@ -411,6 +412,30 @@

+
+

+ Library Names +

+ + link + + +
+ Library names should follow camel case convention (with the exception of the subsystem names) and be prefixed with O2. +
+
+ +
+
+ +
+

+ Executable Names +

+ + link + + +
+ Executable names should be in lowercase, prefixed with o2, and hyphenated : o2-tpc-reco-workflow +
-

- Executable Names -

- - link - - -
- Executable names should be in lowercase, prefixed with o2, and hyphenated : o2-tpc-reco-workflow -
-
- +
- +
+ +
+

+ Library Names +

+ + link + + +
+ Library names should follow camel case convention (with the exception of the subsystem names) and be prefixed with + O2. +
-

- Library Names -

- - link - - -
- Library names should follow camel case convention (with the exception of the subsystem names) and be prefixed with O2. -
-
- + +
+

Type Names

From 12a68c6021a8cfbf0e17fa706247b12253703a28 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Fri, 19 Jul 2019 17:12:05 +0200 Subject: [PATCH 19/27] File Name -> Code File Name --- naming_formatting.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/naming_formatting.html b/naming_formatting.html index 1aa20ac..f20c49e 100644 --- a/naming_formatting.html +++ b/naming_formatting.html @@ -173,7 +173,7 @@

ALICE O² C++ Naming & Formatting Rules

-

File Names

+

Code File Names

link From 6fe9fc780b4cd868b2fe3f007781df20f647601c Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Wed, 9 Oct 2019 14:53:14 +0200 Subject: [PATCH 20/27] Acronyms can be capitalized --- naming_formatting.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/naming_formatting.html b/naming_formatting.html index f20c49e..7c6d69f 100644 --- a/naming_formatting.html +++ b/naming_formatting.html @@ -288,11 +288,13 @@

General Naming Rule All names in C++ code follow camel case convention. This is the practice of writing compound words so that each word begins with a capital letter. No underscores are allowed. + Acronyms are the only exception : they can be capitalized.

For example:

string tableName;   // Good
+
class ITSReco       // Good, acronyms can be capitalized
string table_name;  // Bad - uses underscore.
 string tablename;   // Bad - all lowercase.

From 793aff43b8d670534581a0414935758ffb803c77 Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Mon, 28 Sep 2020 09:43:46 +0200 Subject: [PATCH 21/27] Consistency fix for namespace rules --- naming_formatting.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/naming_formatting.html b/naming_formatting.html index 7c6d69f..84f07ab 100644 --- a/naming_formatting.html +++ b/naming_formatting.html @@ -303,7 +303,7 @@

General Naming Rule Capitalization Rules

Variables and functions start with a lowercase letter.
- Everything else in C++ code (namespaces, type names, constant + Everything else in C++ code (type names, constant expressions) starts with an uppercase letter.

@@ -1145,9 +1145,9 @@

Namespaces

When declaring nested namespaces, put each namespace on its own line.

-
namespace Foo 
+      
namespace foo 
 {
-namespace Bar 
+namespace bar 
 {
 ...
 }

From bdf27980835f23477dcfeb527ae377cbd1769a32 Mon Sep 17 00:00:00 2001
From: David Rohr 
Date: Fri, 5 Feb 2021 12:10:28 +0100
Subject: [PATCH 22/27] Clarify difference between clang-format and
 git-clang-format

---
 README.md | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index 5e0f73b..f3457ae 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,20 @@ wget llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format
 chmod u+x git-clang-format
 ```
 
+#### Check commits' formatting
+`git clang-format` invokes `clang-format` on the changes in current files
+or a specific commit. E.g. for the last commit
+```
+git clang-format HEAD~1
+```
+
+Or for all commits done with respect to the remote branch state
+```
+git clang-format origin/dev
+```
+
 #### Check files' formatting
+Please note that for technical reasons, there are slight differences between `clang-format` and `git-clang-format` (see above). All pull requests are checked with `git-clang-format` as described in the previous bullet. Thus make sure that before pushing code, correct the formatting with `git-clang-format`. The instructions for `clang-format` are left here only for reference.
 Show correctly formatted version of a file :
 ```
 clang-format -style=file SOURCEFILE
@@ -59,18 +72,6 @@ Display what needs to be fixed in a file :
 clang-format -style=file  | diff  -
 ```
 
-#### Check commits' formatting
-`git clang-format` invokes `clang-format` on the changes in current files
-or a specific commit. E.g. for the last commit
-```
-git clang-format HEAD~1
-```
-
-Or for all commits done with respect to the remote branch state
-```
-git clang-format origin/dev
-```
-
 #### Using an IDE
 A number of config files are available [here](https://github.com/AliceO2Group/CodingGuidelines) for various IDEs.
 

From c93b6af2c221821a2c8c59907f639f3ede71badd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= 
Date: Tue, 2 Mar 2021 14:18:29 +0100
Subject: [PATCH 23/27] Fix link to git-clang-format.

---
 README.md | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index f3457ae..b3782e5 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Coding guidelines for the ALICE O2 project.
 * [Comments guidelines](https://rawgit.com/AliceO2Group/CodingGuidelines/master/comments_guidelines.html)
 
 ### Formatting tool
-The ALICE O2 projects use `clang-format` to push for a common code formatting. The rules are defined in 
+The ALICE O2 projects use `clang-format` to push for a common code formatting. The rules are defined in
 the `clang-format` configuration file in this repository (which is propagated to other AliceO2Group repositories). With an adiabatic
 approach, all changes have to follow the formatting rules. A script, described below, can be
 used to integrate the formatting into `git` and suggest formatting only for
@@ -18,7 +18,7 @@ changed lines.
 
 #### Install `clang-format` and git integration
 
-Note : The installation of clang using aliBuild is not necessary on Mac. 
+Note : The installation of clang using aliBuild is not necessary on Mac.
 
 1. Build clang (to be done once)
 ```bash
@@ -33,7 +33,7 @@ alienv enter Clang/latest
 cd $HOME
 mkdir -p bin
 cd bin
-wget llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format
+wget https://raw.githubusercontent.com/llvm/llvm-project/main/clang/tools/clang-format/git-clang-format
 chmod u+x git-clang-format
 ```
 
@@ -61,13 +61,13 @@ Directly apply the style to a file :
 clang-format -style=file -i SOURCEFILE
 ```
 
-Apply the style to all the source and header files in a directory (recursive) : 
+Apply the style to all the source and header files in a directory (recursive) :
 
 ```
-find . -iname "*.h" -o -iname "*.cpp" | xargs clang-format -style=file -i 
+find . -iname "*.h" -o -iname "*.cpp" | xargs clang-format -style=file -i
 ```
 
-Display what needs to be fixed in a file : 
+Display what needs to be fixed in a file :
 ```
 clang-format -style=file  | diff  -
 ```
@@ -80,9 +80,9 @@ A number of config files are available [here](https://github.com/AliceO2Group/Co
 
 #### CLion
 1. [Download](https://github.com/AliceO2Group/CodingGuidelines/raw/master/settings-o2-codestyle-clion.jar),
-2. Go to File -> Import Settings. 
+2. Go to File -> Import Settings.
 
 ## FAQ
 * __Q__ I strongly disagree with rule X !
 * __A__ Feel free to contact the WP3 (alice-o2-wp3@cern.ch) to share your concern(s). Rules have already been amended, abandoned or added based on the users feedback. However, please comply with the rules until a change is agreed by CWG11.
- 
+

From e72f0d2ec8e24f48e68ef0f94077c2881f8c1d56 Mon Sep 17 00:00:00 2001
From: sy-c 
Date: Wed, 23 Jun 2021 09:59:03 +0200
Subject: [PATCH 24/27] Update README.md (#23)

Specify that commands rely on .clang-format file.
---
 README.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/README.md b/README.md
index b3782e5..61f0f3a 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,12 @@ git clang-format origin/dev
 ```
 
 #### Check files' formatting
+
+The commands below rely on the [.clang-format](.clang-format) file located in one of the parent
+directories of the source files.
+
 Please note that for technical reasons, there are slight differences between `clang-format` and `git-clang-format` (see above). All pull requests are checked with `git-clang-format` as described in the previous bullet. Thus make sure that before pushing code, correct the formatting with `git-clang-format`. The instructions for `clang-format` are left here only for reference.
+
 Show correctly formatted version of a file :
 ```
 clang-format -style=file SOURCEFILE

From 2593120848ba715ea9f9701c402036d308b949b9 Mon Sep 17 00:00:00 2001
From: David Rohr 
Date: Tue, 22 Jun 2021 13:30:31 +0200
Subject: [PATCH 25/27] Update exception policy

---
 coding_guidelines.html | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/coding_guidelines.html b/coding_guidelines.html
index 79720fc..88595d8 100644
--- a/coding_guidelines.html
+++ b/coding_guidelines.html
@@ -1897,13 +1897,18 @@ 

Exceptions

link
- Use C++ exceptions instead of return codes for error handling. Do not use exceptions to return values. + C++ exceptions can be used for error handling in non-performance-relevant code, like context initialization running only once during the lifetime of the program. + Usually return values shall be used.