Skip to content

Commit

Permalink
add fmt-checking hook
Browse files Browse the repository at this point in the history
  • Loading branch information
hdhoang committed Feb 24, 2019
1 parent ea7abc6 commit a0abc63
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ To analyze the firmware's code size, you need [cargo-bloat](https://github.com/R
- `make bloat`
- `make bloat BLOAT_ARGS="--crates" # passing arguments to cargo-bloat`

Our CI requires consistent formatting, please run rustfmt before you submit PRs:
Our CI requires consistent formatting, please use our pre-commit hook
to make sure:

- `cp scripts/pre-commit .git/hooks/pre-commit`

To fix formatting:

- `make fmt`

Expand Down
4 changes: 4 additions & 0 deletions scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e

cargo fmt --all -- --check
10 changes: 7 additions & 3 deletions src/bluetooth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ where
.log_error();
}
_ => {
crate::heprintln!("msg: System {} {:?}", message.operation, message.data).ok();
crate::heprintln!("msg: System {} {:?}", message.operation, message.data)
.ok();
}
}
}
Expand Down Expand Up @@ -230,7 +231,8 @@ where
crate::heprintln!("TODO: Keyboard Sync").ok();
}
_ => {
crate::heprintln!("msg: Keyboard {} {:?}", message.operation, message.data).ok();
crate::heprintln!("msg: Keyboard {} {:?}", message.operation, message.data)
.ok();
}
},
MsgType::Macro => match MacroOp::from(message.operation) {
Expand All @@ -244,7 +246,9 @@ where
_ => {
crate::heprintln!(
"msg: {:?} {} {:?}",
message.msg_type, message.operation, message.data
message.msg_type,
message.operation,
message.data
)
.ok();
}
Expand Down
8 changes: 6 additions & 2 deletions src/led.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ where
_ => {
crate::heprintln!(
"lmsg: {:?} {} {:?}",
message.msg_type, message.operation, message.data
message.msg_type,
message.operation,
message.data
)
.ok();
}
Expand All @@ -231,7 +233,9 @@ where
_ => {
crate::heprintln!(
"lmsg: {:?} {} {:?}",
message.msg_type, message.operation, message.data
message.msg_type,
message.operation,
message.data
)
.ok();
}
Expand Down

0 comments on commit a0abc63

Please sign in to comment.