Skip to content

Commit

Permalink
add fmt hook and config
Browse files Browse the repository at this point in the history
  • Loading branch information
nkostoulas committed Feb 25, 2019
1 parent e7d27ad commit ce4fe99
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 8 deletions.
16 changes: 16 additions & 0 deletions .hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
format_strings = true
wrap_comments = true
format_doc_comments = true
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# 0.1.0

* Playing with Rust
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions examples/test_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -32,6 +32,6 @@ fn main_result() -> Result<(), Error> {
fn main() {
match main_result() {
Err(e) => println!("{}", e),
_ => ()
_ => (),
};
}
1 change: 0 additions & 1 deletion src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
pub fn run() {
println!("Running Coordinator daemon!");
}

3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! # Coordinator Library
//!
//! Basic functionality required by Coordinator daemon
//!
// Coding conventions
#![deny(non_upper_case_globals)]
Expand All @@ -18,4 +17,4 @@
extern crate ocean_rpc;
extern crate rust_ocean;

pub mod daemon;
pub mod daemon;
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! # Main
//!
//! Main daemon entry
//!
extern crate coordinator;

Expand Down

0 comments on commit ce4fe99

Please sign in to comment.