Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-11101: [Rust] rewrite pre-commit hook #9072

Closed
wants to merge 1 commit into from

Conversation

mqy
Copy link
Contributor

@mqy mqy commented Jan 1, 2021

Currently, the client side git pre-commit hook checks and runs cargo fmt with stable version, but the CI check may fail in nightly version occasionally even if the code has been formatted with stable.

It seems that, this problem can be resolved by: running cargo +nighty fmt before cargo +stable fmt. Thus pre-commit.sh should be updated in this way.

In this PR:

  1. only check staged *.rs files and exit if no changes
  2. cargo clippy is moved before cargo fmt
  3. run cargo +nighty fmt before cargo +stable fmt
  4. show more concise tip messages
  5. abort the commit if there are files changed by cargo fmt

@codecov-io
Copy link

Codecov Report

Merging #9072 (552bb06) into master (cc0ee5e) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #9072   +/-   ##
=======================================
  Coverage   82.55%   82.55%           
=======================================
  Files         203      203           
  Lines       50043    50043           
=======================================
+ Hits        41313    41315    +2     
+ Misses       8730     8728    -2     
Impacted Files Coverage Δ
rust/parquet/src/arrow/schema.rs 90.93% <0.00%> (+0.31%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc0ee5e...552bb06. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jan 1, 2021

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave this a try locally -- and it seems to work well. Thanks @mqy -- I think I may start using this hook myself :)

@alamb alamb closed this in 745f612 Jan 3, 2021
@mqy mqy deleted the rewrite-pre-commit-hook branch January 3, 2021 15:45
@mqy mqy restored the rewrite-pre-commit-hook branch January 3, 2021 15:45
@mqy mqy deleted the rewrite-pre-commit-hook branch January 3, 2021 15:49
GeorgeAp pushed a commit to sirensolutions/arrow that referenced this pull request Jun 7, 2021
Currently,  the client side git pre-commit hook checks and runs `cargo fmt` with stable version, but the CI check may fail in nightly version occasionally even if the code has been formatted with stable.

It seems that, this problem can be resolved by: running `cargo +nighty fmt` before  `cargo +stable fmt`. Thus `pre-commit.sh` should be updated in this way.

In this PR:

1. only check staged *.rs files and exit if no changes
2. cargo clippy is moved before cargo fmt
3. run `cargo +nighty fmt` before  cargo +stable fmt
4. show more concise tip messages
5. abort the commit if there are files changed by `cargo fmt`

Closes apache#9072 from mqy/rewrite-pre-commit-hook

Authored-by: mqy <meng.qingyou@gmail.com>
Signed-off-by: Andrew Lamb <andrew@nerdnetworks.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants