Skip to content

Commit

Permalink
Adding pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreOucif committed Jul 6, 2023
1 parent bb0a64e commit 456a731
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
- name: Check code formatting
run: cargo +nightly fmt -- --check

- name: Check codecov.yml file format
run: curl --data-binary @- https://codecov.io/validate < codecov.yml
# - name: Check codecov.yml file format
# run: curl --data-binary @- https://codecov.io/validate < codecov.yml

check:
name: Check
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/doublify/pre-commit-rust
rev: master
hooks:
- id: fmt
- id: cargo-check
- id: clippy
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# rust-template
# od-rust-template


## pre-commit

`pre-commit install`

To run all on all files `pre-commit run --all-files `
9 changes: 4 additions & 5 deletions application/rest-api-adapter/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#[macro_use]
pub extern crate rocket;
use rocket::{Build, get, Rocket};
use rocket::{get, Build, Rocket};

#[get("/")]
pub fn index() -> &'static str {
"Hello, world!"
"Hello, world!"
}


pub fn build_api() -> Rocket<Build> {
rocket::build().mount("/", routes![index])
}
rocket::build().mount("/", routes![index])
}
7 changes: 2 additions & 5 deletions bootstrap/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ use rest_api_adapter::build_api;

#[rocket::main]
async fn main() -> Result<(), rocket::Error> {
build_api()
.launch()
.await?;
Ok(())
build_api().launch().await?;
Ok(())
}

0 comments on commit 456a731

Please sign in to comment.