Skip to content

Commit 158d509

Browse files
authored
Add pre-commit config (#16)
1 parent b5c3d45 commit 158d509

File tree

15 files changed

+107
-25
lines changed

15 files changed

+107
-25
lines changed

.asf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ notifications:
4545
4646
4747
pullrequests: [email protected]
48-
jira_options: link label link label
48+
jira_options: link label link label

.github/.licenserc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ header:
1212
- 'LICENSE'
1313
- 'NOTICE'
1414

15-
comment: on-failure
15+
comment: on-failure

.github/dependabot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ updates:
2323
schedule:
2424
interval: "daily"
2525
open-pull-requests-limit: 10
26-

.github/workflows/pre-commit.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: pre-commit
19+
20+
on:
21+
pull_request:
22+
push:
23+
branches:
24+
- '**'
25+
- '!dependabot/**'
26+
27+
jobs:
28+
pre-commit:
29+
runs-on: ubuntu-24.04
30+
steps:
31+
- uses: actions/checkout@v3
32+
- uses: actions/setup-python@v3
33+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# To use this, install the python package `pre-commit` and
19+
# run once `pre-commit install`. This will setup a git pre-commit-hook
20+
# that is executed on each commit and will report the linting problems.
21+
# To run all hooks on all files use `pre-commit run -a`
22+
23+
repos:
24+
- repo: https://github.com/pre-commit/pre-commit-hooks
25+
rev: v5.0.0
26+
hooks:
27+
- id: trailing-whitespace
28+
- id: end-of-file-fixer
29+
- id: check-yaml
30+
- id: check-added-large-files
31+
32+
- repo: https://github.com/pre-commit/mirrors-clang-format
33+
rev: v19.1.5
34+
hooks:
35+
- id: clang-format
36+
37+
- repo: https://github.com/cheshirekow/cmake-format-precommit
38+
rev: v0.6.10
39+
hooks:
40+
- id: cmake-format

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,4 @@
198198
distributed under the License is distributed on an "AS IS" BASIS,
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201-
limitations under the License.
201+
limitations under the License.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ Apache Iceberg is an active open-source project, governed under the Apache Softw
5959

6060
The Apache Iceberg community is built on the principles described in the [Apache Way](https://www.apache.org/theapacheway/index.html) and all who engage with the community are expected to be respectful, open, come with the best interests of the community in mind, and abide by the Apache Foundation [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
6161

62+
### Linting
63+
64+
Install the python package `pre-commit` and run once `pre-commit install`.
65+
66+
```
67+
pip install pre-commit
68+
pre-commit install
69+
```
70+
71+
This will setup a git pre-commit-hook that is executed on each commit and will report the linting problems. To run all hooks on all files use `pre-commit run -a`.
72+
6273
## License
6374

6475
Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)

api/iceberg/puffin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
namespace iceberg {
2626

2727
class Puffin {
28-
public:
28+
public:
2929
virtual ~Puffin() = default;
3030
virtual std::string_view print() const = 0;
3131
static std::unique_ptr<Puffin> create();
3232
};
3333

34-
} // namespace iceberg
34+
} // namespace iceberg

api/iceberg/table.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
namespace iceberg {
2626

2727
class Table {
28-
public:
28+
public:
2929
virtual ~Table() = default;
3030
virtual std::string_view print() const = 0;
3131
static std::unique_ptr<Table> create();
3232
};
3333

34-
} // namespace iceberg
34+
} // namespace iceberg

cmake_modules/BuildUtils.cmake

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ function(iceberg_install_cmake_package PACKAGE_NAME EXPORT_NAME)
2222
set(CONFIG_CMAKE "${PACKAGE_NAME}Config.cmake")
2323
set(BUILT_CONFIG_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_CMAKE}")
2424
configure_package_config_file("${CONFIG_CMAKE}.in" "${BUILT_CONFIG_CMAKE}"
25-
INSTALL_DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/${PACKAGE_NAME}")
25+
INSTALL_DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/${PACKAGE_NAME}"
26+
)
2627
set(CONFIG_VERSION_CMAKE "${PACKAGE_NAME}ConfigVersion.cmake")
2728
set(BUILT_CONFIG_VERSION_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_VERSION_CMAKE}")
2829
write_basic_package_version_file("${BUILT_CONFIG_VERSION_CMAKE}"
@@ -137,8 +138,8 @@ function(ADD_ICEBERG_LIB LIB_NAME)
137138
endif()
138139

139140
set_target_properties(${LIB_NAME}_shared
140-
PROPERTIES LINK_FLAGS "${ARG_SHARED_LINK_FLAGS}"
141-
OUTPUT_NAME ${LIB_NAME})
141+
PROPERTIES LINK_FLAGS "${ARG_SHARED_LINK_FLAGS}" OUTPUT_NAME
142+
${LIB_NAME})
142143

143144
target_link_libraries(${LIB_NAME}_shared
144145
PUBLIC "$<BUILD_INTERFACE:${ARG_SHARED_LINK_LIBS}>"
@@ -187,12 +188,12 @@ function(ADD_ICEBERG_LIB LIB_NAME)
187188
set(LIB_NAME_STATIC ${LIB_NAME})
188189
endif()
189190

190-
set_target_properties(${LIB_NAME}_static
191-
PROPERTIES OUTPUT_NAME ${LIB_NAME_STATIC})
191+
set_target_properties(${LIB_NAME}_static PROPERTIES OUTPUT_NAME ${LIB_NAME_STATIC})
192192

193193
if(ARG_STATIC_INSTALL_INTERFACE_LIBS)
194194
target_link_libraries(${LIB_NAME}_static
195-
INTERFACE "$<INSTALL_INTERFACE:${ARG_STATIC_INSTALL_INTERFACE_LIBS}>")
195+
INTERFACE "$<INSTALL_INTERFACE:${ARG_STATIC_INSTALL_INTERFACE_LIBS}>"
196+
)
196197
endif()
197198

198199
if(ARG_STATIC_LINK_LIBS)

0 commit comments

Comments
 (0)