2010YOUY01 opened a new pull request, #580:
URL: https://github.com/apache/sedona-db/pull/580
## Rationale
Now `clippy` check is not available in local pre-commit hooks, this PR:
1. Extract ci's `cargo clippy` check to a local script for consistency
2. Reuse this script for local pre-commit check
I have tested it locally:
```sh
(.venv) yongting@Yongtings-MacBook-Pro-2 ~/C/sedona-db (pre-commit-clippy)>
git diff
diff --git a/rust/sedona-geoparquet/src/file_opener.rs
b/rust/sedona-geoparquet/src/file_opener.rs
index ae2a56d..a0ca352 100644
--- a/rust/sedona-geoparquet/src/file_opener.rs
+++ b/rust/sedona-geoparquet/src/file_opener.rs
@@ -205,7 +205,7 @@ fn filter_access_plan_using_geoparquet_covering(
let row_group_indices_to_scan = access_plan.row_group_indexes();
// What we're about to do is a bit of work, so skip it if we can.
- if row_group_indices_to_scan.is_empty() {
+ if row_group_indices_to_scan.len() == 0 {
return Ok(());
}
(.venv) yongting@Yongtings-MacBook-Pro-2 ~/C/sedona-db (pre-commit-clippy
*)> git add .
(.venv) yongting@Yongtings-MacBook-Pro-2 ~/C/sedona-db (pre-commit-clippy
+)> git commit -m "test clippy violation"
check illegal windows names..........................(no files to
check)Skipped
...
clang-format.........................................(no files to
check)Skipped
cargo clippy fix workspace (best
effort).................................Failed
- hook id: cargo-clippy-fix-workspace
- files were modified by this hook
Checking sedona-geo-traits-ext v0.3.0
(/Users/yongting/Code/sedona-db/rust/sedona-geo-traits-ext)
...
Checking sedonadb v0.3.0 (/Users/yongting/Code/sedona-db/python/sedonadb)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 26.46s
(.venv) yongting@Yongtings-MacBook-Pro-2 ~/C/sedona-db (pre-commit-clippy
+*) [0|1]> git diff
diff --git a/rust/sedona-geoparquet/src/file_opener.rs
b/rust/sedona-geoparquet/src/file_opener.rs
index a0ca352..ae2a56d 100644
--- a/rust/sedona-geoparquet/src/file_opener.rs
+++ b/rust/sedona-geoparquet/src/file_opener.rs
@@ -205,7 +205,7 @@ fn filter_access_plan_using_geoparquet_covering(
let row_group_indices_to_scan = access_plan.row_group_indexes();
// What we're about to do is a bit of work, so skip it if we can.
- if row_group_indices_to_scan.len() == 0 {
+ if row_group_indices_to_scan.is_empty() {
return Ok(());
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]