diff --git a/.hooks/pre-commit b/.hooks/pre-commit new file mode 100755 index 0000000..29993d4 --- /dev/null +++ b/.hooks/pre-commit @@ -0,0 +1,16 @@ +#!/bin/bash + +CARGO_FMT="cargo +nightly fmt" + +$CARGO_FMT --version &>/dev/null +if [ $? != 0 ]; then + printf "[pre_commit] \033[0;31merror\033[0m: \"$CARGO_FMT\" not available?\n" + exit 1 +fi + +$CARGO_FMT -- --check +if [ $? != 0 ]; then + printf "[pre_commit] $CARGO_FMT → \033[0;31merror\033[0m \n" +else + printf "[pre_commit] $CARGO_FMT → \033[0;32mOK\033[0m \n" +fi diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..a13f6e8 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,3 @@ +format_strings = true +wrap_comments = true +format_doc_comments = true diff --git a/.travis.yml b/.travis.yml index 0a20c3f..3fedb89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,15 @@ language: rust + rust: - stable - beta - nightly - 1.32.0 +before_script: + rustup component add rustfmt --toolchain nightly + script: + - cargo +nightly fmt --all -- --check - cargo build --verbose - cargo test --verbose diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..461048c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ + +# 0.1.0 + +* Playing with Rust diff --git a/README.md b/README.md index 8190627..a2e0c62 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# Guardnode Coordinator +# Coordinator -Guardnode Coordinator implementation for the Commerceblock Covalence system +Implementation of the Coordinator daemon, responsible for verifying the operation of Guardnodes in the Commerceblock Covalence system diff --git a/examples/test_rpc.rs b/examples/test_rpc.rs index 5a4d762..1720d70 100644 --- a/examples/test_rpc.rs +++ b/examples/test_rpc.rs @@ -3,7 +3,7 @@ extern crate ocean_rpc; extern crate rust_ocean; -use ocean_rpc::{RpcApi, Client, Error}; +use ocean_rpc::{Client, Error, RpcApi}; fn main_result() -> Result<(), Error> { let mut args = std::env::args(); @@ -32,6 +32,6 @@ fn main_result() -> Result<(), Error> { fn main() { match main_result() { Err(e) => println!("{}", e), - _ => () + _ => (), }; } diff --git a/src/daemon.rs b/src/daemon.rs index a8b4769..b4cd566 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -7,4 +7,3 @@ pub fn run() { println!("Running Coordinator daemon!"); } - diff --git a/src/lib.rs b/src/lib.rs index afdae7e..a822420 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,6 @@ //! # Coordinator Library //! //! Basic functionality required by Coordinator daemon -//! // Coding conventions #![deny(non_upper_case_globals)] @@ -18,4 +17,4 @@ extern crate ocean_rpc; extern crate rust_ocean; -pub mod daemon; \ No newline at end of file +pub mod daemon; diff --git a/src/main.rs b/src/main.rs index 8094c65..0d3063a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,6 @@ //! # Main //! //! Main daemon entry -//! extern crate coordinator;