Skip to content

Commit

Permalink
chore: ensure same lint config regardless of the environment
Browse files Browse the repository at this point in the history
The config currently needs to be kept in each root module right now, which is inconvenient and error-prone. Hopefully it gets fixed soon. For a good summary see here: EmbarkStudios/rust-ecosystem#59
  • Loading branch information
ivan-aksamentov committed Mar 28, 2022
1 parent f838249 commit 60b2c4d
Show file tree
Hide file tree
Showing 5 changed files with 662 additions and 168 deletions.
170 changes: 2 additions & 168 deletions docker-dev
Original file line number Diff line number Diff line change
Expand Up @@ -48,174 +48,6 @@ export COLORBT_SHOW_HIDDEN="0"
export RUST_LOG="warn"
export CARGO_BUILD_TARGET_DIR="${BUILD_DIR_REL}"

export LINT_NORMAL="\
-Wfuture_incompatible \
-Wnonstandard_style \
-Wrust_2018_idioms \
-Wtrivial_numeric_casts \
\
-Wclippy::all \
\
-Wclippy::await_holding_lock \
-Wclippy::char_lit_as_u8 \
-Wclippy::checked_conversions \
-Wclippy::dbg_macro \
-Wclippy::debug_assert_with_mut_call \
-Wclippy::disallowed_script_idents \
-Wclippy::doc_markdown \
-Wclippy::empty_enum \
-Wclippy::enum_glob_use \
-Wclippy::equatable_if_let \
-Wclippy::exit \
-Wclippy::expl_impl_clone_on_copy \
-Wclippy::explicit_deref_methods \
-Wclippy::explicit_into_iter_loop \
-Wclippy::fallible_impl_from \
-Wclippy::filter_map_next \
-Wclippy::flat_map_option \
-Wclippy::float_cmp_const \
-Wclippy::fn_params_excessive_bools \
-Wclippy::fn_to_numeric_cast_any \
-Wclippy::from_iter_instead_of_collect \
-Wclippy::if_let_mutex \
-Wclippy::implicit_clone \
-Wclippy::imprecise_flops \
-Wclippy::index_refutable_slice \
-Wclippy::inefficient_to_string \
-Wclippy::invalid_upcast_comparisons \
-Wclippy::iter_not_returning_iterator \
-Wclippy::large_digit_groups \
-Wclippy::large_stack_arrays \
-Wclippy::large_types_passed_by_value \
-Wclippy::let_unit_value \
-Wclippy::linkedlist \
-Wclippy::lossy_float_literal \
-Wclippy::macro_use_imports \
-Wclippy::manual_ok_or \
-Wclippy::map_err_ignore \
-Wclippy::map_flatten \
-Wclippy::map_unwrap_or \
-Wclippy::match_on_vec_items \
-Wclippy::match_same_arms \
-Wclippy::match_wild_err_arm \
-Wclippy::match_wildcard_for_single_variants \
-Wclippy::mem_forget \
-Wclippy::mismatched_target_os \
-Wclippy::missing_enforced_import_renames \
-Wclippy::mut_mut \
-Wclippy::mutex_integer \
-Wclippy::needless_continue \
-Wclippy::needless_for_each \
-Wclippy::negative_feature_names \
-Wclippy::nonstandard_macro_braces \
-Wclippy::option_option \
-Wclippy::path_buf_push_overwrite \
-Wclippy::ptr_as_ptr \
-Wclippy::rc_mutex \
-Wclippy::ref_option_ref \
-Wclippy::rest_pat_in_fully_bound_structs \
-Wclippy::same_functions_in_if_condition \
-Wclippy::semicolon_if_nothing_returned \
-Wclippy::single_match_else \
-Wclippy::string_add \
-Wclippy::string_add_assign \
-Wclippy::string_lit_as_bytes \
-Wclippy::string_to_string \
-Wclippy::todo \
-Wclippy::trailing_empty_array \
-Wclippy::trait_duplication_in_bounds \
-Wclippy::unimplemented \
-Wclippy::unnecessary_wraps \
-Wclippy::unnested_or_patterns \
-Wclippy::useless_transmute \
-Wclippy::verbose_file_reads \
-Wclippy::zero_sized_map_values \
"

export LINT_EXTRA="\
${LINT_NORMAL} \
-Wclippy::pedantic \
"

export LINT_CRAZY="\
${LINT_EXTRA} \
-Wclippy::restriction \
-Wclippy::nursery \
"

export LINT_ALLOW_NOW_BUT_FIX_THESE_LATER=" \
-Aclippy::cognitive-complexity \
-Aclippy::else-if-without-else \
-Aclippy::expect-used \
-Aclippy::missing-const-for-fn \
-Aclippy::panic \
-Aclippy::panic-in-result-fn \
-Aclippy::suboptimal_flops \
-Aclippy::too_many_arguments \
-Aclippy::unsafe-derive-deserialize \
-Aclippy::unwrap-in-result \
-Aclippy::unwrap-used \
-Aclippy::useless-transmute \
"

export LINT_ALLOW=" \
${LINT_ALLOW_NOW_BUT_FIX_THESE_LATER} \
-Aclippy::as-conversions \
-Aclippy::cast-lossless \
-Aclippy::cast-possible-truncation \
-Aclippy::cast-possible-wrap \
-Aclippy::cast-precision-loss \
-Aclippy::cast-sign-loss \
-Aclippy::default-numeric-fallback \
-Aclippy::doc-markdown \
-Aclippy::exhaustive-enums \
-Aclippy::exhaustive-structs \
-Aclippy::float-arithmetic \
-Aclippy::if-not-else \
-Aclippy::implicit-hasher \
-Aclippy::implicit-return \
-Aclippy::inconsistent_digit_grouping \
-Aclippy::indexing-slicing \
-Aclippy::integer-arithmetic \
-Aclippy::integer-division \
-Aclippy::iter_nth_zero \
-Aclippy::large_digit_groups \
-Aclippy::let-underscore-must-use \
-Aclippy::match-same-arms \
-Aclippy::missing-docs-in-private-items \
-Aclippy::missing-errors-doc \
-Aclippy::missing-panics-doc \
-Aclippy::missing_inline_in_public_items \
-Aclippy::mod-module-files \
-Aclippy::module-name-repetitions \
-Aclippy::module_inception \
-Aclippy::must-use-candidate \
-Aclippy::new_without_default \
-Aclippy::non-ascii-literal \
-Aclippy::option-if-let-else \
-Aclippy::pattern-type-mismatch \
-Aclippy::print-stderr \
-Aclippy::print-stdout \
-Aclippy::separated-literal-suffix \
-Aclippy::shadow-reuse \
-Aclippy::shadow-same \
-Aclippy::shadow-unrelated \
-Aclippy::should_implement_trait \
-Aclippy::similar-names \
-Aclippy::too-many-lines \
-Aclippy::unnecessary-wraps \
-Aclippy::unreachable \
-Aclippy::unreadable-literal \
-Aclippy::unused-self \
-Aclippy::unused-unit \
-Aclippy::use-debug \
-Aclippy::use-self \
-Aclippy::wildcard-enum-match-arm \
"

export LINT_FIX="--fix --allow-staged"


export EXTENSIONS_TO_WATCH="rs,toml,lock"

export FILES_TO_WATCH="\
Expand All @@ -240,6 +72,8 @@ export FILES_TO_IGNORE="\
-i 'packages_rs/nextclade-web/src/gen/' \
"

export LINT_FIX="--fix --allow-staged"

BUILD=0
RUN=0
WASM=0
Expand Down
165 changes: 165 additions & 0 deletions packages_rs/nextclade-web/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,168 @@
// Configuration of Rust lints (static analysis). Scroll past it to find the actual code.
// This needs to be kept in each root module right now, which is inconvenient and error-prone.
// Hopefully it gets fixed soon. For a good summary see here: https://github.com/EmbarkStudios/rust-ecosystem/issues/59
//
//
// Disable some of the default rust checks
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(unused_variables)]
//
// Enable some of the default lints which are disabled by default
#![warn(nonstandard_style)]
#![warn(rust_2018_idioms)]
#![warn(trivial_numeric_casts)]
//
// Enable all clippy lint groups
// Order is important!
#![warn(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(clippy::blanket_clippy_restriction_lints)]
#![warn(clippy::restriction)]
#![warn(clippy::nursery)]
//
// Enable some of the clippy lints disabled by default
#![warn(clippy::await_holding_lock)]
#![warn(clippy::char_lit_as_u8)]
#![warn(clippy::checked_conversions)]
#![warn(clippy::dbg_macro)]
#![warn(clippy::debug_assert_with_mut_call)]
#![warn(clippy::disallowed_script_idents)]
#![warn(clippy::doc_markdown)]
#![warn(clippy::empty_enum)]
#![warn(clippy::enum_glob_use)]
#![warn(clippy::equatable_if_let)]
#![warn(clippy::exit)]
#![warn(clippy::expl_impl_clone_on_copy)]
#![warn(clippy::explicit_deref_methods)]
#![warn(clippy::explicit_into_iter_loop)]
#![warn(clippy::fallible_impl_from)]
#![warn(clippy::filter_map_next)]
#![warn(clippy::flat_map_option)]
#![warn(clippy::float_cmp_const)]
#![warn(clippy::fn_params_excessive_bools)]
#![warn(clippy::fn_to_numeric_cast_any)]
#![warn(clippy::from_iter_instead_of_collect)]
#![warn(clippy::if_let_mutex)]
#![warn(clippy::implicit_clone)]
#![warn(clippy::imprecise_flops)]
#![warn(clippy::index_refutable_slice)]
#![warn(clippy::inefficient_to_string)]
#![warn(clippy::invalid_upcast_comparisons)]
#![warn(clippy::iter_not_returning_iterator)]
#![warn(clippy::large_digit_groups)]
#![warn(clippy::large_stack_arrays)]
#![warn(clippy::large_types_passed_by_value)]
#![warn(clippy::let_unit_value)]
#![warn(clippy::linkedlist)]
#![warn(clippy::lossy_float_literal)]
#![warn(clippy::macro_use_imports)]
#![warn(clippy::manual_ok_or)]
#![warn(clippy::map_err_ignore)]
#![warn(clippy::map_flatten)]
#![warn(clippy::map_unwrap_or)]
#![warn(clippy::match_on_vec_items)]
#![warn(clippy::match_same_arms)]
#![warn(clippy::match_wild_err_arm)]
#![warn(clippy::match_wildcard_for_single_variants)]
#![warn(clippy::mem_forget)]
#![warn(clippy::mismatched_target_os)]
#![warn(clippy::missing_enforced_import_renames)]
#![warn(clippy::mut_mut)]
#![warn(clippy::mutex_integer)]
#![warn(clippy::needless_continue)]
#![warn(clippy::needless_for_each)]
#![warn(clippy::negative_feature_names)]
#![warn(clippy::nonstandard_macro_braces)]
#![warn(clippy::option_option)]
#![warn(clippy::path_buf_push_overwrite)]
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::rc_mutex)]
#![warn(clippy::ref_option_ref)]
#![warn(clippy::rest_pat_in_fully_bound_structs)]
#![warn(clippy::same_functions_in_if_condition)]
#![warn(clippy::semicolon_if_nothing_returned)]
#![warn(clippy::single_match_else)]
#![warn(clippy::string_add)]
#![warn(clippy::string_add_assign)]
#![warn(clippy::string_lit_as_bytes)]
#![warn(clippy::string_to_string)]
#![warn(clippy::trailing_empty_array)]
#![warn(clippy::trait_duplication_in_bounds)]
#![warn(clippy::unimplemented)]
#![warn(clippy::unnecessary_wraps)]
#![warn(clippy::unnested_or_patterns)]
#![warn(clippy::useless_transmute)]
#![warn(clippy::verbose_file_reads)]
#![warn(clippy::zero_sized_map_values)]
//
// Disabled clippy lints, up for discussion
#![allow(clippy::cognitive_complexity)]
#![allow(clippy::else_if_without_else)]
#![allow(clippy::expect_used)]
#![allow(clippy::missing_const_for_fn)]
#![allow(clippy::panic)]
#![allow(clippy::panic_in_result_fn)]
#![allow(clippy::suboptimal_flops)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::unsafe_derive_deserialize)]
#![allow(clippy::unwrap_in_result)]
#![allow(clippy::unwrap_used)]
#![allow(clippy::useless_transmute)]
//
// Disabled clippy lints, permanent
#![allow(clippy::as_conversions)]
#![allow(clippy::cast_lossless)]
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::cast_possible_wrap)]
#![allow(clippy::cast_precision_loss)]
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::default_numeric_fallback)]
#![allow(clippy::doc_markdown)]
#![allow(clippy::exhaustive_enums)]
#![allow(clippy::exhaustive_structs)]
#![allow(clippy::float_arithmetic)]
#![allow(clippy::if_not_else)]
#![allow(clippy::implicit_hasher)]
#![allow(clippy::implicit_return)]
#![allow(clippy::inconsistent_digit_grouping)]
#![allow(clippy::indexing_slicing)]
#![allow(clippy::integer_arithmetic)]
#![allow(clippy::integer_division)]
#![allow(clippy::iter_nth_zero)]
#![allow(clippy::large_digit_groups)]
#![allow(clippy::let_underscore_must_use)]
#![allow(clippy::match_same_arms)]
#![allow(clippy::missing_docs_in_private_items)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::missing_inline_in_public_items)]
#![allow(clippy::missing_panics_doc)]
#![allow(clippy::mod_module_files)]
#![allow(clippy::module_inception)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::must_use_candidate)]
#![allow(clippy::new_without_default)]
#![allow(clippy::non_ascii_literal)]
#![allow(clippy::option_if_let_else)]
#![allow(clippy::pattern_type_mismatch)]
#![allow(clippy::print_stderr)]
#![allow(clippy::print_stdout)]
#![allow(clippy::separated_literal_suffix)]
#![allow(clippy::shadow_reuse)]
#![allow(clippy::shadow_same)]
#![allow(clippy::shadow_unrelated)]
#![allow(clippy::should_implement_trait)]
#![allow(clippy::similar_names)]
#![allow(clippy::too_many_lines)]
#![allow(clippy::unnecessary_wraps)]
#![allow(clippy::unreachable)]
#![allow(clippy::unreadable_literal)]
#![allow(clippy::unused_self)]
#![allow(clippy::unused_unit)]
#![allow(clippy::use_debug)]
#![allow(clippy::use_self)]
#![allow(clippy::wildcard_enum_match_arm)]

use wasm_bindgen::prelude::*;

use nextclade::analyze::analyze::{AnalysisInput, AnalysisResult, Nextclade, NextcladeParams};
Expand Down
Loading

0 comments on commit 60b2c4d

Please sign in to comment.