From 02957015b3a1fc7a61bd37ceecf5a1460b336aea Mon Sep 17 00:00:00 2001 From: Maxi Wittich Date: Thu, 1 Oct 2026 11:54:56 +0200 Subject: [PATCH 1/3] adding crate typos and typos.toml --- .pre-commit-config.yaml | 10 +++++++++ typos.toml | 48 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 typos.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 19e02aba8..ff4cad251 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,6 +3,16 @@ default_language_version: node: system repos: + - repo: https://github.com/crate-ci/typos + rev: 00f422f3b19c57bc6338715ebfe3316d38768461 # v1.50.3 + hooks: + - id: typos + # Drop the upstream default `--write-changes` so the hook reports and + # fails instead of rewriting files. + # Keep `--force-exclude` so the + # excludes in typos.toml still apply to the paths prek passes in. + args: ["--force-exclude"] + - repo: https://github.com/pre-commit/pre-commit-hooks rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # 5.0.0 hooks: diff --git a/typos.toml b/typos.toml new file mode 100644 index 000000000..de9066b0b --- /dev/null +++ b/typos.toml @@ -0,0 +1,48 @@ +# Configuration for typos (https://github.com/crate-ci/typos), run via the prek +# hook in .pre-commit-config.yaml. +# +# Before adding an entry here, consider an in-place marker instead. Use one when +# the word is correct at this one site and would still be a typo elsewhere: +# +# # spellchecker:disable-line at the end of the line it applies to +# # spellchecker:ignore-next-line on its own line, above the offending line +# # spellchecker:off / :on around a block +# +# Every entry below gets a one-line comment saying what the word is. + +[files] +# Bare `typos` skips hidden dirs by default, but prek passes explicit paths and +# so does check them. Turn it off so both agree. +ignore-hidden = false + +extend-exclude = [ + # `.git` itself, which ignore-hidden = false would otherwise pull in. + ".git/", + # Generated by `cargo xtask crd preview`. Most of the content is Kubernetes' + # own schema documentation, which is not ours to correct, and the doc + # comments we do own are already checked at their source. + "crates/stackable-operator/crds/", + # Generated by `cargo insta`. The inputs they are rendered from are checked + # at their source in the sibling `inputs/` directories. + "crates/*/tests/snapshots/", +] + +[default] +# typos has no native suppression directive +# (https://github.com/crate-ci/typos/issues/316), so these regexes provide one. +# They cover `#`, `//`, ``, `;`, `/* */` and Jinja `{# #}` comments, +# which spans every file type in this repo. +# +# Both failure modes are safe: +# * unterminated `:off` suppresses nothing rather than swallowing the rest of the file. +# * `disable-line` only matches when the marker ends the line. +extend-ignore-re = [ + "(?Rm)^.*(#|//||#\\}|\\*/)?\\s*$", + "(#|//||#\\}|\\*/)?\\s*\\n.*", + "(?s)(#|//||#\\}|\\*/|\")?.*?(#|//||#\\}|\\*/|\")?", +] + +[default.extend-words] +# Accepted variant of "unparsable". Used in stackable-versioned test fixture file +# names (`unparseable_missing_field.json`), where an in-place marker cannot go. +unparseable = "unparseable" From b8dc03f82ef0ca225f323aefab3f17086c21e39c Mon Sep 17 00:00:00 2001 From: Maxi Wittich Date: Thu, 1 Oct 2026 14:52:45 +0200 Subject: [PATCH 2/3] Updating yoke-derive --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 02573c11a..db3144c69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5215,9 +5215,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33811428bee40dbceb6d545e95754741d17a6aef9a4849f0fd62e2ba4f412a78" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" dependencies = [ "proc-macro2", "quote", From cf28b85d494565bc1783160107d17c00f6706690 Mon Sep 17 00:00:00 2001 From: Maxi Wittich Date: Thu, 1 Oct 2026 14:58:16 +0200 Subject: [PATCH 3/3] Adding typos results and exclusions --- crates/config-utils/src/template/cli_args.rs | 2 +- crates/config-utils/src/template/mod.rs | 8 +++++--- .../src/commons/product_image_selection.rs | 2 +- crates/stackable-operator/src/kvp/label/mod.rs | 2 +- crates/stackable-operator/src/v2/env_overrides.rs | 2 ++ .../src/v2/macros/attributed_string_type.rs | 2 +- crates/stackable-telemetry/src/tracing/mod.rs | 2 +- .../tests/inputs/pass/shortnames.rs | 2 +- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/crates/config-utils/src/template/cli_args.rs b/crates/config-utils/src/template/cli_args.rs index 7075018d9..fbcbe4732 100644 --- a/crates/config-utils/src/template/cli_args.rs +++ b/crates/config-utils/src/template/cli_args.rs @@ -15,7 +15,7 @@ pub struct TemplateCommand { #[arg(value_enum)] pub file_type: Option, - /// By default inserted values are automatically escaped according to the deteced file format. You can disable + /// By default inserted values are automatically escaped according to the detected file format. You can disable /// this, e.g. when you need to insert XML tags (as they otherwise would be escaped). /// NOTE: Please make sure to correctly escape the inserted text on your own! #[clap(long)] diff --git a/crates/config-utils/src/template/mod.rs b/crates/config-utils/src/template/mod.rs index ee65b2ca3..dc4311605 100644 --- a/crates/config-utils/src/template/mod.rs +++ b/crates/config-utils/src/template/mod.rs @@ -31,7 +31,7 @@ pub enum Error { #[snafu(display( "The extension {extension} is not known, can not determine file type. Please specify the file type manually." ))] - ExtensionUnkown { extension: String }, + ExtensionUnkown { extension: String }, // spellchecker:disable-line #[snafu(display("Failed to create temporary file {tmp_file_name:?}"))] CreateTemporaryFile { @@ -63,6 +63,7 @@ pub enum Error { #[snafu(display( "Could not find the end pattern {end_pattern:?} in expression {expression:?}" ))] + // spellchecker:ignore-next-line FindEndPatten { end_pattern: String, expression: String, @@ -95,7 +96,7 @@ pub fn template(file_name: &PathBuf, file_type: Option<&FileType>, escape: bool) KNOWN_FILE_TYPES .get(extension) - .context(ExtensionUnkownSnafu { extension })? + .context(ExtensionUnkownSnafu { extension })? // spellchecker:disable-line } }; @@ -198,7 +199,7 @@ fn replacement_action_for_env_var(env_var_name: &str) -> Result { /// * `replacement_action` must be a function that is called and get passed the [`&str`] content between the start and end /// pattern. This can e.g. be the name of the env var or file name to read. /// -/// Returns wether the `line` was modified. +/// Returns whether the `line` was modified. fn replace_thingy_in_line( line: &mut String, start_pattern: &str, @@ -223,6 +224,7 @@ fn replace_thingy_in_line( debug_assert_eq!(&line[index..index + start_pattern.len()], start_pattern); let (parameter, _) = line[index + start_pattern.len()..] .split_once(end_pattern) + // spellchecker:ignore-next-line .context(FindEndPattenSnafu { // FIXME: Truncate string to not bloat error message expression: &line[index..], diff --git a/crates/stackable-operator/src/commons/product_image_selection.rs b/crates/stackable-operator/src/commons/product_image_selection.rs index 163680f7d..cd9089711 100644 --- a/crates/stackable-operator/src/commons/product_image_selection.rs +++ b/crates/stackable-operator/src/commons/product_image_selection.rs @@ -132,7 +132,7 @@ pub struct ResolvedProductImage { /// Kubernetes' supported image pull policies. /// -/// Our product image selection choses the policy automatically based on two factors: +/// Our product image selection chooses the policy automatically based on two factors: /// /// - If the image pull policy is explicitly set by the user /// - If the used Stackable version is considered floating/the user opted for diff --git a/crates/stackable-operator/src/kvp/label/mod.rs b/crates/stackable-operator/src/kvp/label/mod.rs index b763d52f0..852aeceec 100644 --- a/crates/stackable-operator/src/kvp/label/mod.rs +++ b/crates/stackable-operator/src/kvp/label/mod.rs @@ -450,7 +450,7 @@ impl Labels { /// /// This function returns a result, because the parameters `owner`, `app_name`, /// and `role` can contain invalid data or can exceed the maximum allowed - /// number fo characters. + /// number of characters. pub fn role_selector(owner: &R, app_name: &str, role: &str) -> Result where R: Resource, diff --git a/crates/stackable-operator/src/v2/env_overrides.rs b/crates/stackable-operator/src/v2/env_overrides.rs index 0d0519bd2..67d7f8d74 100644 --- a/crates/stackable-operator/src/v2/env_overrides.rs +++ b/crates/stackable-operator/src/v2/env_overrides.rs @@ -117,6 +117,7 @@ mod tests { #[test] fn deserialize_rejects_invalid_names() { // "=" is not allowed in environment variable names. + // spellchecker:off let result: Result = serde_json::from_value(json!({ "FO=O": "1" })); @@ -128,6 +129,7 @@ mod tests { ), result.map_err(|err| err.to_string()) ); + // spellchecker:on } #[test] diff --git a/crates/stackable-operator/src/v2/macros/attributed_string_type.rs b/crates/stackable-operator/src/v2/macros/attributed_string_type.rs index 3f17b5868..44aa26524 100644 --- a/crates/stackable-operator/src/v2/macros/attributed_string_type.rs +++ b/crates/stackable-operator/src/v2/macros/attributed_string_type.rs @@ -767,7 +767,7 @@ mod tests { } #[test] - fn test_attributed_string_type_json_schema_without_constaints() { + fn test_attributed_string_type_json_schema_without_constraints() { type T = JsonSchemaWithoutConstraintsTest; T::test_example(); diff --git a/crates/stackable-telemetry/src/tracing/mod.rs b/crates/stackable-telemetry/src/tracing/mod.rs index 64b75e4be..81a9cf3f0 100644 --- a/crates/stackable-telemetry/src/tracing/mod.rs +++ b/crates/stackable-telemetry/src/tracing/mod.rs @@ -562,7 +562,7 @@ impl Tracing { // NOTE (@NickLarsenNZ): There are various propagators. Eg: TraceContextPropagator // standardises HTTP headers to propagate trace-id, parent-id, etc... while the // BaggagePropagator sets a "baggage" header with the value being key=value pairs. There - // are other kinds too. There is also B3 and Jaeger, and some legacy stuff like OT Trace + // are other kinds too. There is also B3 and Jaeger, and some legacy stuff like OT Trace // spellchecker:disable-line // and OpenCensus. // See: https://opentelemetry.io/docs/specs/otel/context/api-propagators/ TraceContextPropagator::new(), diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/shortnames.rs b/crates/stackable-versioned-macros/tests/inputs/pass/shortnames.rs index 299c0d3ae..6484495b5 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/shortnames.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/shortnames.rs @@ -3,7 +3,7 @@ use stackable_versioned::versioned; #[versioned(version(name = "v1alpha1"))] // --- pub(crate) mod versioned { - #[versioned(crd(group = "stackable.tech", shortname = "f", shortname = "fo", doc = "Test"))] + #[versioned(crd(group = "stackable.tech", shortname = "f", shortname = "fo", doc = "Test"))] // spellchecker:disable-line #[derive( Clone, Debug,