diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..34200b7 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,24 @@ +--- +kind: pipeline +name: default + +workspace: + base: /drone/diplonat + +steps: +- name: code style + image: rust:1.47 + commands: + - rustup component add rustfmt + - cargo fmt --all -- --check +# - name: code quality +# image: rust:1.47 +# commands: +# - cargo clippy -- --deny warnings +# - name: test +# image: rust:1.47 +# commands: +# - cargo build --verbose --all +# - cargo test --verbose --all + + \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..f8de6cc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,34 @@ +# Contributing to Diplonat + +## Development guidelines + +### Code formatting + +[Our CI pipeline](./.drone.yml) features a verification of the code format, using [rustfmt](https://github.com/rust-lang/rustfmt). + +#### Installing rustfmt + +You can run `rustfmt` with Rust 1.24 and above. + +To install: + +``` +rustup component add rustfmt +``` + +#### Usage + +To run on Diplonat, launch the following in the root directory: + +``` +cargo fmt --all +``` + +This will format the whole repository using the settigs defined in [`.rustfmt.toml`](./.rustfmt.toml): soft tabs of 2 spaces. + +#### Auto-format code + +You can automate formatting in a number of ways: + +* [Setup your IDE to use `rustfmt`](https://github.com/rust-lang/rustfmt#running-rustfmt-from-your-editor). +* Setup a git hook to run `rustfmt` before each commit. diff --git a/README.md b/README.md index 6f3b7f4..a82811b 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ export RUST_LOG=debug cargo run ``` +## Contributing + +Refer to [CONTRIBUTING.md](./CONTRIBUTING.md). + ## Design Guidelines Diplonat is made of a set of Components. diff --git a/src/config/options_test.rs b/src/config/options_test.rs index 0dfaaac..3d74d7d 100644 --- a/src/config/options_test.rs +++ b/src/config/options_test.rs @@ -44,13 +44,6 @@ fn all_valid_options() -> HashMap { opts } -// #[test] -// #[should_panic] -// fn err_empty_env() { -// std::env::remove_var("DIPLONAT_CONSUL_NODE_NAME"); -// ConfigOpts::from_env().unwrap(); -// } - #[test] #[should_panic] fn err_empty_env() { diff --git a/src/fw.rs b/src/fw.rs index e18a301..3cb4afb 100644 --- a/src/fw.rs +++ b/src/fw.rs @@ -97,3 +97,4 @@ pub fn cleanup(ipt: &iptables::IPTables) -> Result<()> { Ok(()) } + diff --git a/src/fw_actor.rs b/src/fw_actor.rs index d41a97f..c32ee5a 100644 --- a/src/fw_actor.rs +++ b/src/fw_actor.rs @@ -93,3 +93,4 @@ impl FirewallActor { return Ok(()); } } +