Skip to content

Apache DataFusion SQL Query Engine

dev: Add typos check to the local `dev/rust_lint.sh` (#17863)

Yongting Youa1bb74b409a5
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 33ba902cef..2a996ec367 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -34,6 +34,7 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- name: Install HawkEye
+ # This CI job is bound by installation time, use `--profile dev` to speed it up
run: cargo install hawkeye --version 6.2.0 --locked --profile dev
- name: Run license header check
run: ci/scripts/license_header.sh
@@ -57,3 +58,18 @@ jobs:
README.md \
CONTRIBUTING.md
git diff --exit-code
+
+ typos:
+ name: Spell Check with Typos
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: false
+ # Version fixed on purpose. It uses heuristics to detect typos, so upgrading
+ # it may cause checks to fail more often.
+ # We can upgrade it manually once a while.
+ - name: Install typos-cli
+ run: cargo install typos-cli --locked --version 1.37.0
+ - name: Run typos check
+ run: ci/scripts/typos_check.sh
\ No newline at end of file
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index c494e09767..0275733d60 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -786,12 +786,4 @@ jobs:
run: cargo msrv --output-format json --log-target stdout verify
- name: Check datafusion-proto
working-directory: datafusion/proto
- run: cargo msrv --output-format json --log-target stdout verify
- typos:
- name: Spell Check with Typos
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- with:
- persist-credentials: false
- - uses: crate-ci/typos@2d0ce569feab1f8752f1dde43cc2f2aa53236e06 # v1.40.0
+ run: cargo msrv --output-format json --log-target stdout verify
\ No newline at end of file
diff --git a/ci/scripts/typos_check.sh b/ci/scripts/typos_check.sh
new file mode 100755
index 0000000000..a3a4a89321
--- /dev/null
+++ b/ci/scripts/typos_check.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -ex
+# To use this script, you must have installed `typos`, for example:
+# cargo install typos-cli --locked --version 1.37.0
+typos --config typos.toml
diff --git a/dev/rust_lint.sh b/dev/rust_lint.sh
index 8fe7220085..490720c537 100755
--- a/dev/rust_lint.sh
+++ b/dev/rust_lint.sh
@@ -19,6 +19,10 @@
# This script runs all the Rust lints locally the same way the
# DataFusion CI does
+#
+# Note: The installed checking tools (e.g., taplo) are not guaranteed to match
+# the CI versions for simplicity, there might be some minor differences. Check
+# `.github/workflows` for the CI versions.
# For `.toml` format checking
set -e
@@ -33,8 +37,15 @@ if ! command -v hawkeye &> /dev/null; then
cargo install hawkeye --locked
fi
+# For spelling checks
+if ! command -v typos &> /dev/null; then
+ echo "Installing typos using cargo"
+ cargo install typos-cli --locked
+fi
+
ci/scripts/rust_fmt.sh
ci/scripts/rust_clippy.sh
ci/scripts/rust_toml_fmt.sh
ci/scripts/rust_docs.sh
-ci/scripts/license_header.sh
\ No newline at end of file
+ci/scripts/license_header.sh
+ci/scripts/typos_check.sh
diff --git a/typos.toml b/typos.toml
index 09c5c55c45..196766f12f 100644
--- a/typos.toml
+++ b/typos.toml
@@ -46,5 +46,9 @@ extend-exclude = [
"dev/changelog/**",
"benchmarks/**",
"*.csv",
- "docs/source/contributor-guide/governance.md"
+ "docs/source/contributor-guide/governance.md",
+ # submodules
+ "parquet-testing/**",
+ "datafusion-testing/**",
+ "testing/**",
]