Skip to content

Commit 9e84b57

Browse files
authored
Use the clang-format pre-commit hook updated to the latest version (#2039)
* Add .clang-format file * Use latest version of clang-format pre-commit hook * Update black and ruff to latest * Update to actions/setup-python@v5 and actions/checkout@v4 * Format files
1 parent 3d42661 commit 9e84b57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+9427
-8299
lines changed

.clang-format

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: AlwaysBreak
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlinesLeft: true
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: None
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: true
20+
AlwaysBreakTemplateDeclarations: true
21+
BinPackArguments: false
22+
BinPackParameters: false
23+
BraceWrapping:
24+
AfterClass: false
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: false
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
BeforeCatch: false
33+
BeforeElse: false
34+
IndentBraces: false
35+
BreakBeforeBinaryOperators: None
36+
BreakBeforeBraces: Attach
37+
BreakBeforeTernaryOperators: false
38+
BreakConstructorInitializersBeforeComma: true
39+
BreakAfterJavaFieldAnnotations: false
40+
BreakStringLiterals: true
41+
ColumnLimit: 80
42+
CommentPragmas: '^ IWYU pragma:'
43+
BreakBeforeInheritanceComma: false
44+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
45+
ConstructorInitializerIndentWidth: 4
46+
ContinuationIndentWidth: 4
47+
Cpp11BracedListStyle: true
48+
DerivePointerAlignment: false
49+
DisableFormat: false
50+
ExperimentalAutoDetectBinPacking: false
51+
FixNamespaceComments: true
52+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
53+
IncludeCategories:
54+
- Regex: '^<.*\.h>'
55+
Priority: 1
56+
- Regex: '^<.*'
57+
Priority: 2
58+
- Regex: '.*'
59+
Priority: 3
60+
IncludeIsMainRegex: '([-_](test|unittest))?$'
61+
IndentCaseLabels: true
62+
IndentWidth: 4
63+
IndentWrappedFunctionNames: false
64+
JavaScriptQuotes: Leave
65+
JavaScriptWrapImports: true
66+
KeepEmptyLinesAtTheStartOfBlocks: false
67+
MacroBlockBegin: ''
68+
MacroBlockEnd: ''
69+
MaxEmptyLinesToKeep: 1
70+
NamespaceIndentation: None
71+
PenaltyBreakAssignment: 300
72+
PenaltyBreakBeforeFirstCallParameter: 1
73+
PenaltyBreakComment: 300
74+
PenaltyBreakFirstLessLess: 120
75+
PenaltyBreakString: 1000
76+
PenaltyExcessCharacter: 1000000
77+
PenaltyReturnTypeOnItsOwnLine: 200
78+
PointerAlignment: Left
79+
ReflowComments: true
80+
SortIncludes: true
81+
SpaceAfterCStyleCast: false
82+
SpaceAfterTemplateKeyword: true
83+
SpaceBeforeAssignmentOperators: true
84+
SpaceBeforeParens: ControlStatements
85+
SpaceInEmptyParentheses: false
86+
SpacesBeforeTrailingComments: 2
87+
SpacesInAngles: false
88+
SpacesInContainerLiterals: true
89+
SpacesInCStyleCastParentheses: false
90+
SpacesInParentheses: false
91+
SpacesInSquareBrackets: false
92+
Standard: Cpp11
93+
TabWidth: 8
94+
UseTab: Never

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
if: startsWith(matrix.os, 'windows')
4545

4646
- name: Set up Python ${{ matrix.python-version }}
47-
uses: actions/setup-python@v4
47+
uses: actions/setup-python@v5
4848
with:
4949
python-version: ${{ matrix.python-version }}
5050

.github/workflows/daily-test-build-numpy.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
run: printenv
9797

9898
- name: Checkout TileDB-Py `main`
99-
uses: actions/checkout@v3
99+
uses: actions/checkout@v4
100100

101101
- name: Build TileDB-Py
102102
run: pip install --verbose .[test]
@@ -122,7 +122,7 @@ jobs:
122122
needs: test
123123
if: failure() || cancelled()
124124
steps:
125-
- uses: actions/checkout@v3
125+
- uses: actions/checkout@v4
126126
- name: Create Issue if Build Fails
127127
uses: TileDB-Inc/github-actions/open-issue@main
128128
with:

.github/workflows/daily-test-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
needs: test
8686
if: failure() || cancelled()
8787
steps:
88-
- uses: actions/checkout@v3
88+
- uses: actions/checkout@v4
8989
- name: Create Issue if Build Fails
9090
uses: TileDB-Inc/github-actions/open-issue@main
9191
with:

.github/workflows/format.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,4 @@ jobs:
1010
- uses: actions/setup-python@v4
1111

1212
- name: Run pre-commit hooks on all files
13-
run: python -m pip -v install pre-commit && pre-commit run -a -v
14-
15-
- name: Check formatting (linux only)'
16-
run: |
17-
source $GITHUB_WORKSPACE/ci/scripts/check_formatting_linux.sh
18-
shell: bash
19-
if: ${{ runner.os == 'Linux' }}
13+
run: python -m pip -v install pre-commit && pre-commit run -a -v

.pre-commit-config.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
repos:
22
- repo: https://github.com/ambv/black
3-
rev: 22.12.0
3+
rev: 24.10.0
44
hooks:
55
- id: black
66
- repo: https://github.com/charliermarsh/ruff-pre-commit
7-
rev: v0.4.4
7+
rev: v0.9.3
88
hooks:
99
- id: ruff
10+
- repo: https://github.com/pre-commit/mirrors-clang-format
11+
rev: v19.1.7
12+
hooks:
13+
- id: clang-format
14+
types_or: [c++, c]

ci/README.md

-44
This file was deleted.

ci/scripts/check_formatting_linux.sh

-38
This file was deleted.

ci/scripts/install-clangformat.sh

-63
This file was deleted.

ci/scripts/run-clang-format.sh

-63
This file was deleted.

examples/variable_length.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535

3636
import numpy as np
3737

38-
#%%
38+
# %%
3939
import tiledb
4040
from tiledb.tests.common import assert_subarrays_equal
4141

4242
array_name = "variable_length_array"
4343

44-
#%%
44+
# %%
4545

4646

4747
def create_array():

0 commit comments

Comments
 (0)