dentiny opened a new pull request, #1267: URL: https://github.com/apache/iceberg-rust/pull/1267
## What changes are included in this PR? This PR adds linting and formatting logic into precommit hook, the code is copied from CI setup to keep consistency. https://github.com/apache/iceberg-rust/blob/5677d446dec1361459d42a6c3672d8ec605a289a/.github/workflows/ci.yml#L52-L60 The motivation behind is to uncover problems earlier at local environment, rather than CI, which is time-consuming and requires extra round-trip. ## Are these changes tested? I intentionally made bad code changes, and confirm precommit hook works as expected. Example output: ```sh [/workspaces/iceberg-rust] (hjiang/add-precommit-hook) vscode@a9c6eedd4430$ git push format...................................................................Failed - hook id: format - exit code: 1 error: unexpected token: `(` --> /workspaces/iceberg-rust/crates/iceberg/src/transaction/mod.rs:61:39 | 61 | metadata_builder = update.().apply(metadata_builder)?; | ^ Error writing files: failed to resolve mod `transaction`: cannot parse /workspaces/iceberg-rust/crates/iceberg/src/transaction/mod.rs clipper..................................................................Failed - hook id: clipper - exit code: 101 Checking iceberg v0.4.0 (/workspaces/iceberg-rust/crates/iceberg) Checking iceberg_test_utils v0.4.0 (/workspaces/iceberg-rust/crates/test_utils) Checking iceberg-sqllogictest v0.4.0 (/workspaces/iceberg-rust/crates/sqllogictest) error: unexpected token: `(` --> crates/iceberg/src/transaction/mod.rs:61:39 | 61 | metadata_builder = update.().apply(metadata_builder)?; | ^ error[E0618]: expected function, found `&catalog::TableUpdate` --> crates/iceberg/src/transaction/mod.rs:61:32 | 60 | for update in updates { | ------ `update` has type `&catalog::TableUpdate` 61 | metadata_builder = update.().apply(metadata_builder)?; | ^^^^^^--- | | | call expression requires function For more information about this error, try `rustc --explain E0618`. error: could not compile `iceberg` (lib) due to 2 previous errors warning: build failed, waiting for other jobs to finish... error: failed to push some refs to 'github.com:dentiny/iceberg-rust.git' ``` -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
