Skip to content

Commit 025d2fc

Browse files
committed
build: add prek to run pre-commit hook for native module
1 parent 0556f5e commit 025d2fc

File tree

16 files changed

+215
-181
lines changed

16 files changed

+215
-181
lines changed

.github/actions/rust-test/action.yaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,13 @@ description: "Run Rust tests"
2121
runs:
2222
using: "composite"
2323
steps:
24-
- name: Check Cargo fmt
24+
- name: Lint native module
2525
shell: bash
2626
run: |
27+
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.2.23/prek-installer.sh | sh
28+
git config --global --add safe.directory /__w/datafusion-comet/datafusion-comet
2729
cd native
28-
cargo fmt --all -- --check --color=never
29-
30-
- name: Check Cargo clippy
31-
shell: bash
32-
run: |
33-
cd native
34-
cargo clippy --color=never --all-targets --workspace -- -D warnings
35-
36-
- name: Check compilation
37-
shell: bash
38-
run: |
39-
cd native
40-
cargo check --benches
30+
~/.local/bin/prek run --all-files
4131
4232
- name: Check unused dependencies
4333
shell: bash

native/.pre-commit-config.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
repos:
18+
- repo: https://github.com/pre-commit/pre-commit-hooks
19+
rev: v6.0.0
20+
hooks:
21+
- id: trailing-whitespace
22+
- id: end-of-file-fixer
23+
- id: check-yaml
24+
- id: check-toml
25+
26+
- repo: local
27+
hooks:
28+
- id: cargo-fmt
29+
name: check cargo fmt
30+
entry: cargo fmt --all -- --check --color=never
31+
language: system
32+
types: [ rust ]
33+
pass_filenames: false # This makes it a lot faster
34+
35+
- id: cargo-clippy
36+
name: check cargo clippy
37+
entry: cargo clippy --color=never --all-targets --workspace -- -D warnings
38+
language: system
39+
types: [ rust ]
40+
pass_filenames: false
41+
42+
- id: cargo-check
43+
name: check cargo compilation
44+
entry: cargo check --benches
45+
language: system
46+
types: [ rust ]
47+
pass_filenames: false

native/core/testdata/backtrace.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@
1919
at /Users/somebody/src/arrow-datafusion-comet/core/src/errors.rs:369:43
2020
10: Java_org_apache_comet_NativeBase_init
2121
at /Users/somebody/src/arrow-datafusion-comet/core/src/lib.rs:53:5
22-

native/fs-hdfs/c_src/libhdfs/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424

2525
#define HAVE_INTEL_SSE_INTRINSICS
2626

27-
#endif
27+
#endif

native/fs-hdfs/c_src/libhdfs/exception.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
* @param excErrno (out param) The POSIX error number associated with the
9999
* exception.
100100
* @param shouldPrint (out param) Nonzero if we should print this exception,
101-
* based on the noPrintFlags and its name.
101+
* based on the noPrintFlags and its name.
102102
*/
103103
LIBHDFS_EXTERNAL
104104
void getExceptionInfo(const char *excName, int noPrintFlags,

0 commit comments

Comments
 (0)