From 70e51958b4b78018376bb37b7482e0f2305276ee Mon Sep 17 00:00:00 2001 From: Mikhail Cheshkov Date: Sat, 5 Oct 2024 17:23:28 +0300 Subject: [PATCH] ci(cubesql): Turn cargo check to cargo clippy with lots of disabled rules (#8676) --- .github/workflows/rust-cubesql.yml | 8 +-- rust/cubesql/cubesql/Cargo.toml | 87 ++++++++++++++++++++++++++++++ rust/cubesql/pg-srv/Cargo.toml | 11 ++++ 3 files changed, 100 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust-cubesql.yml b/.github/workflows/rust-cubesql.yml index 160c2a4937e61..5c1f717d3296f 100644 --- a/.github/workflows/rust-cubesql.yml +++ b/.github/workflows/rust-cubesql.yml @@ -43,16 +43,12 @@ jobs: run: cd rust/cubesql && cargo fmt --all -- --check - name: Lint Native run: cd packages/cubejs-backend-native && cargo fmt --all -- --check - # TODO replace with clippy once cubesql is ready - - name: Check CubeSQL - run: cd rust/cubesql && cargo check --locked --workspace --all-targets --keep-going + - name: Clippy CubeSQL + run: cd rust/cubesql && cargo clippy --locked --workspace --all-targets --keep-going -- -D warnings - name: Clippy Native run: cd packages/cubejs-backend-native && cargo clippy --locked --workspace --all-targets --keep-going -- -D warnings - name: Clippy Native (with Python) run: cd packages/cubejs-backend-native && cargo clippy --locked --workspace --all-targets --keep-going --features python -- -D warnings - # CubeSQL is not ready for Clippy - #- name: Clippy CubeSQL - # run: cd rust/cubesql && cargo clippy -- -D warnings unit: # We use host instead of cross container, because it's much faster diff --git a/rust/cubesql/cubesql/Cargo.toml b/rust/cubesql/cubesql/Cargo.toml index e88ffd9fc6346..0e32b9568d358 100644 --- a/rust/cubesql/cubesql/Cargo.toml +++ b/rust/cubesql/cubesql/Cargo.toml @@ -83,3 +83,90 @@ harness = false [[bench]] name = "large_model" harness = false + +# Code in cubesql workspace is not ready for full-blown clippy +# So we disable some rules to enable per-rule latch in CI, not for a whole clippy run +# Feel free to remove any rule from here and fix all warnings with it +# Or to write a comment why rule should stay disabled +[lints.clippy] +assign_op_pattern = "allow" +bool_assert_comparison = "allow" +bool_comparison = "allow" +borrowed_box = "allow" +cast_abs_to_unsigned = "allow" +clone_on_copy = "allow" +cmp_owned = "allow" +collapsible_if = "allow" +collapsible_match = "allow" +collapsible_else_if = "allow" +comparison_chain = "allow" +derive_ord_xor_partial_ord = "allow" +expect_fun_call = "allow" +explicit_auto_deref = "allow" +extra_unused_lifetimes = "allow" +field_reassign_with_default = "allow" +filter_map_bool_then = "allow" +filter_map_identity = "allow" +for_kv_map = "allow" +get_first = "allow" +identity_op = "allow" +if_same_then_else = "allow" +into_iter_on_ref = "allow" +iter_cloned_collect = "allow" +iter_next_slice = "allow" +len_without_is_empty = "allow" +len_zero = "allow" +let_and_return = "allow" +manual_filter = "allow" +manual_flatten = "allow" +manual_is_ascii_check = "allow" +manual_map = "allow" +manual_range_contains = "allow" +manual_strip = "allow" +map_clone = "allow" +map_flatten = "allow" +map_identity = "allow" +match_like_matches_macro = "allow" +match_ref_pats = "allow" +match_single_binding = "allow" +missing_transmute_annotations = "allow" +needless_borrow = "allow" +needless_borrows_for_generic_args = "allow" +needless_late_init = "allow" +needless_lifetimes = "allow" +needless_question_mark = "allow" +needless_range_loop = "allow" +needless_return = "allow" +neg_multiply = "allow" +never_loop = "allow" +new_without_default = "allow" +non_canonical_partial_ord_impl = "allow" +nonminimal_bool = "allow" +only_used_in_recursion = "allow" +op_ref = "allow" +option_as_ref_deref = "allow" +partialeq_ne_impl = "allow" +ptr_arg = "allow" +redundant_closure = "allow" +redundant_field_names = "allow" +redundant_pattern = "allow" +redundant_pattern_matching = "allow" +redundant_slicing = "allow" +result_large_err = "allow" +single_match = "allow" +should_implement_trait = "allow" +to_string_in_format_args = "allow" +to_string_trait_impl = "allow" +too_many_arguments = "allow" +type_complexity = "allow" +unnecessary_cast = "allow" +unnecessary_lazy_evaluations = "allow" +unnecessary_mut_passed = "allow" +unnecessary_to_owned = "allow" +unnecessary_unwrap = "allow" +unused_unit = "allow" +unwrap_or_default = "allow" +useless_conversion = "allow" +useless_format = "allow" +useless_vec = "allow" +wrong_self_convention = "allow" diff --git a/rust/cubesql/pg-srv/Cargo.toml b/rust/cubesql/pg-srv/Cargo.toml index 302830eb55ed3..fa226a0c60c93 100644 --- a/rust/cubesql/pg-srv/Cargo.toml +++ b/rust/cubesql/pg-srv/Cargo.toml @@ -26,3 +26,14 @@ chrono = { version = "0.4", package = "chrono", default-features = false, featur [dev-dependencies] hex = "0.4.3" +# Code in cubesql workspace is not ready for full-blown clippy +# So we disable some rules to enable per-rule latch in CI, not for a whole clippy run +# Feel free to remove any rule from here and fix all warnings with it +# Or to write a comment why rule should stay disabled +[lints.clippy] +len_without_is_empty = "allow" +new_without_default = "allow" +redundant_slicing = "allow" +single_char_add_str = "allow" +single_match = "allow" +to_string_trait_impl = "allow"