Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 105 additions & 63 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,93 +1,135 @@
# Copyright (c) 2016 Thomas Heller
# Copyright (c) 2016-2018 Hartmut Kaiser
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

# This .clang-format file is a suggested configuration file for formatting
# source code for the pika project.
#
# Here are a couple of guidelines of how to use this file.
#
# - You should use this file for creating an initial formatting for new files.
#
# - Please separate edits which are pure formatting into isolated commits
# keeping those distinct from edits changing any of the code.
#
# - Please do _not_ configure your editor to automatically format the source
# file while saving edits to disk
# - Please do _not_ reformat a full source file without dire need.

# PLEASE NOTE: This file requires clang-format V18.0

---
Language: Cpp
# BasedOnStyle: LLVM
#AccessModifierOffset: -4
AccessModifierOffset: -2
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
#AlignConsecutiveAssignments: false
#AlignConsecutiveDeclarations: false
#AlignConsecutiveMacros: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignOperands: false
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Allman
#BreakBeforeBraces: Attach
#BreakBeforeBraces: Custom
#BraceWrapping:
# AfterCaseLabel: true
# AfterClass: true
# BreakBeforeBinaryOperators: All
# ConstructorInitializerAllOnOneLineOrOnePerLine: false
BreakConstructorInitializers: BeforeComma
ConstructorInitializerIndentWidth: 0
BreakInheritanceList: BeforeComma
#AllowShortBlocksOnASingleLine: Always
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
#AlwaysBreakAfterReturnType: None
AlwaysBreakAfterReturnType: TopLevelDefinitions
# PenaltyReturnTypeOnItsOwnLine: 1
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeTernaryOperators: true
BreakInheritanceList: BeforeComma
BreakStringLiterals: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
BreakAfterAttributes: Leave
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: true
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
BreakStringLiterals: true
ColumnLimit: 100
#ColumnLimit: 120
# CommentPragmas
CompactNamespaces: false
CommentPragmas: "///"
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
#--DeriveLineEnding: true
#--DerivePointerAlignment: true
DerivePointerAlignment: false
#ExperimentalAutoDetectBinPacking: true # Do weird reformatting
FixNamespaceComments: true
# ForEachMacros: [for_each]
# IncludeBlocks: Regroup
IndentCaseLabels: true
#IndentGotoLabels: false
#IndentPPDirectives: BeforeHash
IndentPPDirectives: None
# ForEachMacros: ['']
IncludeCategories:
- Regex: '^<pika/config\.hpp>'
Priority: 1
- Regex: '^<pika/config/defines\.hpp>'
Priority: 2
- Regex: '^<pika/.*/config\.hpp>'
Priority: 3
- Regex: '^<pika/.*\.hpp>'
Priority: 4
- Regex: '^<pika/parallel/.*\.hpp>'
Priority: 5
- Regex: '^<.*'
Priority: 6
- Regex: '.*'
Priority: 7
# IncludeIsMainRegex: ''
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
IndentPPDirectives: AfterHash
InsertBraces: false
IntegerLiteralSeparator:
Binary: 4
Decimal: 0
Hex: 4
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
# MacroBlockBegin: ''
# MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
NamespaceIndentation: All
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 20
PointerAlignment: Left
PPIndentWidth: 1
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
QualifierAlignment: Right
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
#SpaceBeforeSquareBrackets: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesBeforeTrailingComments: 4
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
# SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
#Standard: Latest
Standard: Cpp11
TabWidth: 4
UseTab: Never



...
20 changes: 20 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI

on:
push:
pull_request:
branches:
- main

jobs:
clang-format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.20
with:
source: "."
exclude: "./ext"
extensions: "hpp,cpp,hpp.in,cu"
clangFormatVersion: 18
style: file
Loading
Loading