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

Add pre-commit hooks in the rust template. #1

Merged
merged 1 commit into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rust-lib-template/.githooks/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To globally enable githooks, run:

git config core.hooksPath .githooks
7 changes: 7 additions & 0 deletions rust-lib-template/.githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Runs automatic formatting and tests

exec cargo fmt -- --check
exec cargo build --all-features
exec cargo test --all-features
1 change: 1 addition & 0 deletions rust-lib-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This is a template project for a general Rust based Biodivine library. It comes
Provided features:
- Travis integration pre-configured with Codecov code coverage.
- `LICENSE` and `.gitignore` files.
- Git hooks to verify formatting and tests integrity before committing (run `git config core.hooksPath .githooks` to enable local git hooks).
- Run `cargo make rich-doc` and `cargo make rich-doc-dev` to generate documentation with Mermaid and KaTeX enabled (`dev` variant includes also internal functions).
- Run `cargo make` to run standard test process and compile basic docs, but also run automatic formatting tool of source code (make sure you apply formatting every time before commit).
- There is a `shields_up` feature flag that can be used to include extra safety checks (invariants, pre-/post-conditions) that should not be needed but may be useful for testing. For usage examples, see the Biodivine Rust developer guide. The flag is off by default, but is enabled during tests on Travis. We provide variants of basic commands with the
Expand Down