Skip to content

Commit a1bb74b

Browse files
2010YOUY01alamb
andauthored
dev: Add typos check to the local dev/rust_lint.sh (#17863)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #. ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> There is a typos check CI job introduced recently. I always end up with typos in my PRs, so I want an easier way to run this typo check locally. `dev/rust_lint.rs` is used to perform all lint checks (fmt, clippy) locally, the typos check should also be suitable to get included. ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> 1. Added `ci/scripts/typos_check.sh` for local typos check, and include it into `dev/rust_lint.sh` 2. Update CI to also use `ci/scripts/typos_check.sh` for consistency 3. Moved typo check CI job from `Rust workflow` to `Dev workflow` ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 4. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> Yes, since CI job is changed, I included one typo in this PR, and it should trigger CI failure. ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
1 parent 0490aec commit a1bb74b

File tree

5 files changed

+57
-11
lines changed

5 files changed

+57
-11
lines changed

.github/workflows/dev.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
3636
- name: Install HawkEye
37+
# This CI job is bound by installation time, use `--profile dev` to speed it up
3738
run: cargo install hawkeye --version 6.2.0 --locked --profile dev
3839
- name: Run license header check
3940
run: ci/scripts/license_header.sh
@@ -57,3 +58,18 @@ jobs:
5758
README.md \
5859
CONTRIBUTING.md
5960
git diff --exit-code
61+
62+
typos:
63+
name: Spell Check with Typos
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
67+
with:
68+
persist-credentials: false
69+
# Version fixed on purpose. It uses heuristics to detect typos, so upgrading
70+
# it may cause checks to fail more often.
71+
# We can upgrade it manually once a while.
72+
- name: Install typos-cli
73+
run: cargo install typos-cli --locked --version 1.37.0
74+
- name: Run typos check
75+
run: ci/scripts/typos_check.sh

.github/workflows/rust.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -786,12 +786,4 @@ jobs:
786786
run: cargo msrv --output-format json --log-target stdout verify
787787
- name: Check datafusion-proto
788788
working-directory: datafusion/proto
789-
run: cargo msrv --output-format json --log-target stdout verify
790-
typos:
791-
name: Spell Check with Typos
792-
runs-on: ubuntu-latest
793-
steps:
794-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
795-
with:
796-
persist-credentials: false
797-
- uses: crate-ci/typos@2d0ce569feab1f8752f1dde43cc2f2aa53236e06 # v1.40.0
789+
run: cargo msrv --output-format json --log-target stdout verify

ci/scripts/typos_check.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
set -ex
21+
# To use this script, you must have installed `typos`, for example:
22+
# cargo install typos-cli --locked --version 1.37.0
23+
typos --config typos.toml

dev/rust_lint.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
# This script runs all the Rust lints locally the same way the
2121
# DataFusion CI does
22+
#
23+
# Note: The installed checking tools (e.g., taplo) are not guaranteed to match
24+
# the CI versions for simplicity, there might be some minor differences. Check
25+
# `.github/workflows` for the CI versions.
2226

2327
# For `.toml` format checking
2428
set -e
@@ -33,8 +37,15 @@ if ! command -v hawkeye &> /dev/null; then
3337
cargo install hawkeye --locked
3438
fi
3539

40+
# For spelling checks
41+
if ! command -v typos &> /dev/null; then
42+
echo "Installing typos using cargo"
43+
cargo install typos-cli --locked
44+
fi
45+
3646
ci/scripts/rust_fmt.sh
3747
ci/scripts/rust_clippy.sh
3848
ci/scripts/rust_toml_fmt.sh
3949
ci/scripts/rust_docs.sh
40-
ci/scripts/license_header.sh
50+
ci/scripts/license_header.sh
51+
ci/scripts/typos_check.sh

typos.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,9 @@ extend-exclude = [
4646
"dev/changelog/**",
4747
"benchmarks/**",
4848
"*.csv",
49-
"docs/source/contributor-guide/governance.md"
49+
"docs/source/contributor-guide/governance.md",
50+
# submodules
51+
"parquet-testing/**",
52+
"datafusion-testing/**",
53+
"testing/**",
5054
]

0 commit comments

Comments
 (0)