From 2b5bd90ce9bdc3ac20b49ce3079a852b1a85c2c2 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Thu, 24 Jul 2025 16:21:18 +0200 Subject: [PATCH 1/2] Add a .clang-format file implementing the Icinga 2 style guide --- .clang-format | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 92 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000000..51a2979e6dc --- /dev/null +++ b/.clang-format @@ -0,0 +1,91 @@ +--- +# As per the style-guide we base our settings on the LLVM style. This is closer +# than any of the other options, but there are more conventions that differ from +# it than the style-guide suggests. +BasedOnStyle: LLVM + +# Default LLVM puts access modifiers (public: etc.) at an offset of -2, meaning +# in the middle between the indentation level of the class and the class members. +# A setting of -4 puts them at the same level as class definitions. +AccessModifierOffset: -4 + +# We don't want to align function parameters or arguments with the open bracket +# but instead always just add a level of indentation. +AlignAfterOpenBracket: BlockIndent + +# Mostly relevant for formatting preprocessor macros so that all backslashes align. +AlignEscapedNewlines: LeftWithLastLine + +# We try to avoid having all parameters of a function declaration on a single line +# Together with 'BinPackParameters' and 'PenaltyReturnTypeOnItsOwnLine' this leads +# to function signatures being either all on one line, or split by argument like a +# list. +AllowAllParametersOfDeclarationOnNextLine: false + +# Put simple getters/setters in class bodies on a single line. +AllowShortFunctionsOnASingleLine: InlineOnly + +# If necessary to break function calls, preferably put each argument on its own line. +BinPackArguments: false + +# If necessary to break function signatures, preferably put each parameter on its own line. +BinPackParameters: false + +# This Breaking style fits our convention and style-guide very closely, therefore +# it is chosen here instead of individual 'BraceWrapping' settings. +BreakBeforeBraces: Mozilla + +# Template declarations are always on their own line +BreakTemplateDeclarations: Yes + +# Convention +ColumnLimit: 120 + +# Includes are sorted according to the style guide, with the additional requirement +# from Boost.Test that the header including the test framework must go first. +IncludeCategories: + - Regex: ^(<|=)BoostTestTargetConfig.h + Priority: 1 + CaseSensitive: false + - Regex: ^"(base|icinga|remote|test)/ + Priority: 2 + CaseSensitive: false + - Regex: ^ Date: Fri, 26 Sep 2025 10:02:11 +0200 Subject: [PATCH 2/2] (Temp) Disable github runners for this PR --- .github/workflows/container-image.yml | 1 - .github/workflows/linux.yml | 1 - .github/workflows/windows.yml | 1 - 3 files changed, 3 deletions(-) diff --git a/.github/workflows/container-image.yml b/.github/workflows/container-image.yml index 18985d65b8d..61be0afb99e 100644 --- a/.github/workflows/container-image.yml +++ b/.github/workflows/container-image.yml @@ -4,7 +4,6 @@ on: push: branches: - master - pull_request: {} release: types: - published diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ac09815deb0..386eb2a2018 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -5,7 +5,6 @@ on: branches: - master - 'support/*' - pull_request: {} concurrency: group: linux-${{ github.event_name == 'push' && github.sha || github.ref }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index be5ffe25e29..905cc47f00f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -5,7 +5,6 @@ on: branches: - master - 'support/*' - pull_request: {} concurrency: group: windows-${{ github.event_name == 'push' && github.sha || github.ref }}