From 5001988e099e1062a0ffa1a563a297e996baba12 Mon Sep 17 00:00:00 2001 From: David Mak Date: Wed, 12 Jun 2024 12:52:00 +0800 Subject: [PATCH] meta: Add pre-commit configuration --- .pre-commit-config.yaml | 24 ++++++++++++++++++++++++ nac3standalone/src/main.rs | 6 ++---- 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a4ae118 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks + +default_stages: [commit] + +repos: + - repo: local + hooks: + - id: nac3-cargo-fmt + name: nac3 cargo format + entry: cargo + language: system + types: [file, rust] + pass_filenames: false + description: Runs cargo fmt on the codebase. + args: [fmt] + - id: nac3-cargo-clippy + name: nac3 cargo clippy + entry: cargo + language: system + types: [file, rust] + pass_filenames: false + description: Runs cargo clippy on the codebase. + args: [clippy] diff --git a/nac3standalone/src/main.rs b/nac3standalone/src/main.rs index d0d24cd..daa0e4d 100644 --- a/nac3standalone/src/main.rs +++ b/nac3standalone/src/main.rs @@ -314,10 +314,8 @@ fn main() { StmtKind::ImportFrom { module, names, .. } if module == &Some("__future__".into()) && names.len() == 1 - && names[0].name == "annotations".into() => - { - () - } + && names[0].name == "annotations".into() => {} + _ => { let (name, def_id, ty) = composer .register_top_level(stmt, Some(resolver.clone()), "__main__", true)