Skip to content

Commit

Permalink
Add config file for optional pre-commit hooks.
Browse files Browse the repository at this point in the history
Run "cargo fmt" on commit. Run "cargo test" on push.
Add introduction to pre-commit in HACKING.md
  • Loading branch information
ffranr committed May 31, 2020
1 parent 220ff6a commit 44e5e6b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://pre-commit.com/ for usage and config
repos:
- repo: local
hooks:
- id: fmt
name: cargo fmt
description: Format files with cargo fmt.
entry: cargo fmt --
language: system
types: [rust]
stages: [commit]
args: []

- id: test
name: cargo test
description: Run tests with cargo test.
entry: cargo test
language: system
types: [rust]
stages: [push]
args: []
13 changes: 13 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@

For core crates, the rule is that any given crate can only depend on the lower layer.

## Continuous Integration

To streamline development, this repository uses continuous integration (CI) to check that tests pass and that the code is correctly formatted.

These checks can be automatically executed locally using [Git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). They will be executed before running Git commands (such as commit). Git hooks for this repository can be trivially installed using the [pre-commit](https://pre-commit.com/) Python package:

```shell
pip install pre-commit
pre-commit install -t pre-commit -t pre-push
```

Hooks for this project are defined in `./.pre-commit-config.yaml`. Pre-commit allows a developer to chose which hooks to install.

## Misc

Other than that there's not that much structure yet, and everything is still fluid
Expand Down
3 changes: 1 addition & 2 deletions crev-lib/src/util/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub use crev_common::{run_with_shell_cmd, store_str_to_file, store_to_file_with,
};
pub use crev_common::{run_with_shell_cmd, store_str_to_file, store_to_file_with};
use crev_data::proof;
use std::{
self, io,
Expand Down

0 comments on commit 44e5e6b

Please sign in to comment.