From 108f97ce479e15d39a555d073e6e0d7cf1208ed5 Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sun, 4 Feb 2024 16:47:07 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'une=20CI=20et=20de=20param=C3=A8tres?= =?UTF-8?q?=20pour=20clippy=20et=20rustfmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/rust.yml | 19 +++++++++++++++++++ Cargo.toml | 9 +++++++++ rustfmt.toml | 18 ++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 .gitea/workflows/rust.yml create mode 100644 rustfmt.toml diff --git a/.gitea/workflows/rust.yml b/.gitea/workflows/rust.yml new file mode 100644 index 0000000..64ac40a --- /dev/null +++ b/.gitea/workflows/rust.yml @@ -0,0 +1,19 @@ +on: [push, pull_request] +name: Rust Checks + +jobs: + checks: + runs-on: main + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Use cache + run: mkdir -p /cache/${{ gitea.repository }} && ln -s /cache/${{ gitea.repository }} target + - name: Cargo fmt + run: cargo fmt --check + - name: Cargo build + run: cargo build + - name: Cargo test + run: cargo test + - name: Cargo clippy + run: cargo clippy -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index 78964fd..017e842 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,15 @@ keywords = ["bevy", "network", "game"] categories = ["network-programming", "game-development"] repository = "https://git.tipragot.fr/tipragot/bevnet" +[lints.rust] +missing_docs = "warn" + +[lints.clippy] +missing_docs_in_private_items = "warn" +unwrap_in_result = "warn" +unwrap_used = "warn" +nursery = "warn" + [dependencies] serde = { version = "1.0.160", features = ["derive"] } bincode = "1.3.3" diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..7bbd24c --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,18 @@ +use_try_shorthand = true +use_field_init_shorthand = true + +version = "Two" +error_on_line_overflow = true +error_on_unformatted = true + +format_code_in_doc_comments = true +format_macro_bodies = true +format_macro_matchers = true +format_strings = true + +imports_granularity = "Module" +group_imports = "StdExternalCrate" + +normalize_doc_attributes = true +normalize_comments = true +wrap_comments = true