From 7c29819187eba44c010f7eaa24d63900f7b0f5f7 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Sun, 1 Sep 2024 19:38:21 +0200 Subject: [PATCH] build: add custom configuration for clippy and rustfmt --- .editorconfig | 4 ++++ cdviz-collector/.clippy.toml | 13 +++++++++++++ cdviz-collector/.rustfmt.toml | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 cdviz-collector/.clippy.toml create mode 100644 cdviz-collector/.rustfmt.toml diff --git a/.editorconfig b/.editorconfig index 8f411f9..f64401c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -66,3 +66,7 @@ indent_size = 4 [*.bat] indent_style = tab indent_size = 4 + +[*.sh] +binary_next_line = true +switch_case_indent = true \ No newline at end of file diff --git a/cdviz-collector/.clippy.toml b/cdviz-collector/.clippy.toml new file mode 100644 index 0000000..32a1d20 --- /dev/null +++ b/cdviz-collector/.clippy.toml @@ -0,0 +1,13 @@ +# Clippy configuration +# https://doc.rust-lang.org/nightly/clippy/lint_configuration.html + +allow-private-module-inception = true +avoid-breaking-exported-api = false +disallowed-names = [] +disallowed-macros = [ + { path = "std::dbg", reason = "it is okay to use during development, but please do not include it in main branch" }, + { path = "std::println", reason = "it is okay to use during development, but please do not include it in main branch, use tracing & log" }, + { path = "std::eprintln", reason = "it is okay to use during development, but please do not include it in main branch, use tracing & log" }, +] +disallowed-methods = [] +disallowed-types = [] diff --git a/cdviz-collector/.rustfmt.toml b/cdviz-collector/.rustfmt.toml new file mode 100644 index 0000000..06a65ad --- /dev/null +++ b/cdviz-collector/.rustfmt.toml @@ -0,0 +1,32 @@ +# Rustfmt configuration +# https://github.com/rust-lang/rustfmt/blob/HEAD/Configurations.md + +# Rustfmt cannot format long lines inside macros, but this option detects this. +# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/3391) +error_on_line_overflow = true + +# Override the default formatting style. +# See https://internals.rust-lang.org/t/running-rustfmt-on-rust-lang-rust-and-other-rust-lang-repositories/8732/81. +use_small_heuristics = "Max" +# This is the default of 2024 edition https://github.com/rust-lang/rust/pull/114764. +# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/3370) +overflow_delimited_expr = true +# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/4991). +imports_granularity = "Crate" +# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/5083). +group_imports = "StdExternalCrate" + +# Apply rustfmt to more places. +# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/3348). +format_code_in_doc_comments = true + +# Automatically fix deprecated style. +use_field_init_shorthand = true +use_try_shorthand = true + +# Set the default settings again to always apply the proper formatting without +# being affected by the editor settings. +edition = "2021" +hard_tabs = false +newline_style = "Unix" +tab_spaces = 4