From fa309c28497168b61835fe4ac5d37d87a26086b1 Mon Sep 17 00:00:00 2001 From: marshmallow Date: Sat, 22 Nov 2025 05:32:19 +0000 Subject: [PATCH] add typos checker --- CHANGELOG.md | 4 ++-- README.md | 2 +- typos.toml | 16 ++++++++++++++++ doc/default.nix | 4 ++-- doc/package.nix | 4 ++-- nix/hooks.nix | 6 ++++++ doc/guides/keys.md | 2 +- doc/guides/targeting.md | 2 +- runtime/module/options.nix | 4 ++-- tests/nix/default.nix | 4 ++-- tests/nix/tools.py | 2 +- wire/cli/default.nix | 2 +- wire/lib/build.rs | 10 +++++----- wire/cli/src/cli.rs | 2 +- wire/cli/src/main.rs | 2 +- wire/lib/src/errors.rs | 8 ++++---- tests/nix/suite/test_keys/default.nix | 10 +++++----- wire/lib/src/hive/mod.rs | 16 ++++++++-------- wire/lib/src/commands/pty/mod.rs | 2 +- wire/lib/src/hive/steps/keys.rs | 2 +- 20 file(s) changed, 63 insertion(s)(+), 41 deletion(s)(-) diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -111,14 +111,14 @@ - There is a new package output, `wire-small`, for testing purposes. It only compiles the key agent for the host that builds `wire-small`. - `--no-progress` now defaults to true if stdin does not refer to a tty (unix pipelines, in CI). -- Added an error for the internal hive evluation parse failure. +- Added an error for the internal hive evaluation parse failure. - The `inspect` command now has `show` as an alias. - Remove `log` command as there are currently no plans to implement the feature - The `completions` command is now hidden from the help page ### Fixed -- A non-existant key owner user/group would not default to gid/uid `0`. +- A non-existent key owner user/group would not default to gid/uid `0`. - Keys can now be deployed to localhost. ## [0.2.0] - 2025-04-21 diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ │ ├── cli │ │ └── Rust binary, using `lib` │ └── key_agent -│ └── Rust binary ran on a target node. recieves key file bytes and metadata w/ protobuf over SSH stdin +│ └── Rust binary ran on a target node. receives key file bytes and metadata w/ protobuf over SSH stdin ├── doc │ └── a [vitepress](https://vitepress.dev/) site ├── runtime diff --git a/typos.toml b/typos.toml new file mode 100644 --- /dev/null +++ b/typos.toml @@ -0,0 +1,16 @@ +[files] +extend-exclude = ["COPYING"] + +[default] +locale = "en-au" + +[type.nix] +# nixpkgs +extend-ignore-re = ["authorizedKeys", "sanitizeDerivationName"] + +[type.md] +extend-ignore-re = ["authorizedKeys", "Initialized empty Git"] + +[type.rust.extend-words] +# serde +serialize = "serialize" diff --git a/doc/default.nix b/doc/default.nix --- a/doc/default.nix +++ b/doc/default.nix @@ -9,11 +9,11 @@ packages = { docs = pkgs.callPackage ./package.nix { mode = "stable"; - inherit (self'.packages) wire-small-dev wire-dignostics-md; + inherit (self'.packages) wire-small-dev wire-diagnostics-md; }; docs-unstable = pkgs.callPackage ./package.nix { - inherit (self'.packages) wire-small-dev wire-dignostics-md; + inherit (self'.packages) wire-small-dev wire-diagnostics-md; }; }; }; diff --git a/doc/package.nix b/doc/package.nix --- a/doc/package.nix +++ b/doc/package.nix @@ -3,7 +3,7 @@ nixosOptionsDoc, runCommand, wire-small-dev, - wire-dignostics-md, + wire-diagnostics-md, nix, nodejs, pnpm, @@ -56,7 +56,7 @@ }; patchPhase = '' cat ${optionsDoc} >> ./reference/module.md - cat ${wire-dignostics-md} >> ./reference/errors.md + cat ${wire-diagnostics-md} >> ./reference/errors.md wire inspect --markdown-help > ./reference/cli.md ''; buildPhase = "pnpm run build > build.log 2>&1"; diff --git a/nix/hooks.nix b/nix/hooks.nix --- a/nix/hooks.nix +++ b/nix/hooks.nix @@ -31,6 +31,12 @@ name = "nix fmt"; entry = "${lib.getExe config.formatter} --no-cache"; }; + typos = { + enable = true; + settings = { + configPath = "typos.toml"; + }; + }; }; diff --git a/doc/guides/keys.md b/doc/guides/keys.md --- a/doc/guides/keys.md +++ b/doc/guides/keys.md @@ -23,7 +23,7 @@ ### Prerequisites -wire uses a Rust binary to recieve encrypted key data, so your deploying +wire uses a Rust binary to receive encrypted key data, so your deploying user must be trusted or you must add garnix as a trusted public key: ```nix diff --git a/doc/guides/targeting.md b/doc/guides/targeting.md --- a/doc/guides/targeting.md +++ b/doc/guides/targeting.md @@ -21,7 +21,7 @@ ## Reading from Stdin -Passing `--on -` will read whitespace-seperated nodes and tags from stdin. This +Passing `--on -` will read whitespace-separated nodes and tags from stdin. This can be combined with normal `--on` usage. For example: diff --git a/runtime/module/options.nix b/runtime/module/options.nix --- a/runtime/module/options.nix +++ b/runtime/module/options.nix @@ -84,13 +84,13 @@ replaceUnknownProfiles = lib.mkOption { type = types.bool; - description = "No-op, colmena compatability"; + description = "No-op, colmena compatibility"; default = true; }; sshOptions = lib.mkOption { type = types.listOf types.str; - description = "No-op, colmena compatability"; + description = "No-op, colmena compatibility"; default = [ ]; }; diff --git a/tests/nix/default.nix b/tests/nix/default.nix --- a/tests/nix/default.nix +++ b/tests/nix/default.nix @@ -86,9 +86,9 @@ let # TODO: Update once #126 is solved. nixPackage = nixpkgs.legacyPackages.lix; - sanitizeName = + sanitiseName = str: lib.strings.sanitizeDerivationName (builtins.replaceStrings [ "." ] [ "_" ] str); - identifier = sanitizeName "${nixpkgs.legacyPackages.lib.trivial.release}-${nixPackage.name}"; + identifier = sanitiseName "${nixpkgs.legacyPackages.lib.trivial.release}-${nixPackage.name}"; path = "tests/nix/suite/${testName}"; flakeDirFileset = lib.fileset.toSource { diff --git a/tests/nix/tools.py b/tests/nix/tools.py --- a/tests/nix/tools.py +++ b/tests/nix/tools.py @@ -6,7 +6,7 @@ return set(machine.succeed("ls /nix/store").strip().split("\n")) -def assert_store_not_posioned(machine: Machine, poison: str, objects: set[str]): +def assert_store_not_poisoned(machine: Machine, poison: str, objects: set[str]): paths = list(map(lambda n: f"/nix/store/{n}", objects)) machine.succeed("which rg") diff --git a/wire/cli/default.nix b/wire/cli/default.nix --- a/wire/cli/default.nix +++ b/wire/cli/default.nix @@ -81,7 +81,7 @@ paths = [ self'.packages.wire-unwrapped-perf ]; }; - wire-dignostics-md = self'.packages.wire-unwrapped.overrideAttrs { + wire-diagnostics-md = self'.packages.wire-unwrapped.overrideAttrs { DIAGNOSTICS_MD_OUTPUT = "/build/source"; installPhase = '' mv /build/source/DIAGNOSTICS.md $out diff --git a/wire/lib/build.rs b/wire/lib/build.rs --- a/wire/lib/build.rs +++ b/wire/lib/build.rs @@ -21,14 +21,14 @@ } #[derive(Debug)] -struct DerviedError { +struct DerivedError { code: Option, help: Option, message: Option, doc_string: String, } -impl Display for DerviedError { +impl Display for DerivedError { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!( f, @@ -61,7 +61,7 @@ } } -impl DerviedError { +impl DerivedError { fn get_error(&mut self, list: &MetaList) -> Result<(), miette::Error> { if list.path.segments.last().unwrap().ident != "error" { return Err(miette!("Not an error")); @@ -153,12 +153,12 @@ let syntax_tree = parse_file(&src) .into_diagnostic() .wrap_err("parsing errors.rs")?; - let mut entries: Vec = Vec::new(); + let mut entries: Vec = Vec::new(); for item in &syntax_tree.items { if let Item::Enum(ItemEnum { variants, .. }) = item { for variant in variants { - let mut entry = DerviedError { + let mut entry = DerivedError { code: None, help: None, message: None, diff --git a/wire/cli/src/cli.rs b/wire/cli/src/cli.rs --- a/wire/cli/src/cli.rs +++ b/wire/cli/src/cli.rs @@ -137,7 +137,7 @@ /// List of literal node names, a literal `-`, or `@` prefixed tags. /// - /// `-` will read additional values from stdin, seperated by whitespace. + /// `-` will read additional values from stdin, separated by whitespace. /// Any `-` implies `--non-interactive`. #[arg(short, long, value_name = "NODE | @TAG | `-`", num_args = 1..)] pub on: Vec, diff --git a/wire/cli/src/main.rs b/wire/cli/src/main.rs --- a/wire/cli/src/main.rs +++ b/wire/cli/src/main.rs @@ -44,7 +44,7 @@ } if !matches!(args.command, cli::Commands::Completions { .. }) && !check_nix_available() { - miette::bail!("Nix is not availabile on this system."); + miette::bail!("Nix is not available on this system."); } let location = get_hive_location(args.path)?; diff --git a/wire/lib/src/errors.rs b/wire/lib/src/errors.rs --- a/wire/lib/src/errors.rs +++ b/wire/lib/src/errors.rs @@ -121,7 +121,7 @@ } #[derive(Debug, Diagnostic, Error)] -pub enum HiveInitializationError { +pub enum HiveInitialisationError { #[diagnostic( code(wire::hive_init::NoHiveFound), help( @@ -213,7 +213,7 @@ WaitForStatus(#[source] std::io::Error), #[diagnostic( - code(wire::detatched::NoHandle), + code(wire::detached::NoHandle), help("This should never happen, please create an issue!"), url("{DOCS_URL}#{}", self.code().unwrap()) )] @@ -247,7 +247,7 @@ url("{DOCS_URL}#{}", self.code().unwrap()), help("please create an issue!"), )] - #[error("Thread paniced")] + #[error("Thread panicked")] ThreadPanic, #[diagnostic( @@ -289,7 +289,7 @@ pub enum HiveLibError { #[error(transparent)] #[diagnostic(transparent)] - HiveInitializationError(HiveInitializationError), + HiveInitialisationError(HiveInitialisationError), #[error(transparent)] #[diagnostic(transparent)] diff --git a/tests/nix/suite/test_keys/default.nix b/tests/nix/suite/test_keys/default.nix --- a/tests/nix/suite/test_keys/default.nix +++ b/tests/nix/suite/test_keys/default.nix @@ -53,7 +53,7 @@ def perform_routine(target, target_object, non_interactive): test_keys(target, target_object, non_interactive) - # only check systemd units on receiver since deployer applys are one time only + # only check systemd units on receiver since deployer apply's are one time only if target == "receiver": target_object.succeed("systemctl start source_string_name-key.path") target_object.succeed("systemctl start command-key.path") @@ -87,10 +87,10 @@ (deployer, new_deployer_store_objects), (receiver, new_receiver_store_objects), ]: - assert_store_not_posioned(node, "hello_world_source", objects) - assert_store_not_posioned(node, "hello_world_file", objects) - assert_store_not_posioned(node, "hello_world_command", objects) - assert_store_not_posioned(node, "string_from_environment", objects) + assert_store_not_poisoned(node, "hello_world_source", objects) + assert_store_not_poisoned(node, "hello_world_file", objects) + assert_store_not_poisoned(node, "hello_world_command", objects) + assert_store_not_poisoned(node, "string_from_environment", objects) ''; }; } diff --git a/wire/lib/src/hive/mod.rs b/wire/lib/src/hive/mod.rs --- a/wire/lib/src/hive/mod.rs +++ b/wire/lib/src/hive/mod.rs @@ -18,7 +18,7 @@ use tracing::{info, instrument}; use crate::commands::common::evaluate_hive_attribute; -use crate::errors::{HiveInitializationError, HiveLocationError}; +use crate::errors::{HiveInitialisationError, HiveLocationError}; use crate::{EvalGoal, HiveLibError, SubCommandModifiers}; pub mod node; pub mod steps; @@ -60,7 +60,7 @@ let output = evaluate_hive_attribute(location, &EvalGoal::Inspect, modifiers).await?; let hive: Hive = serde_json::from_str(&output).map_err(|err| { - HiveLibError::HiveInitializationError(HiveInitializationError::ParseEvaluateError(err)) + HiveLibError::HiveInitialisationError(HiveInitialisationError::ParseEvaluateError(err)) })?; Ok(hive) @@ -75,8 +75,8 @@ self.nodes .get_mut(&Name(Arc::from(node.clone()))) - .ok_or(HiveLibError::HiveInitializationError( - HiveInitializationError::NodeDoesNotExist(node.clone()), + .ok_or(HiveLibError::HiveInitialisationError( + HiveInitialisationError::NodeDoesNotExist(node.clone()), ))? .build_remotely = false; } @@ -371,10 +371,10 @@ .unwrap(); assert_matches!( - hive.force_always_local(vec!["non-existant".to_string()]), - Err(HiveLibError::HiveInitializationError( - HiveInitializationError::NodeDoesNotExist(node) - )) if node == "non-existant" + hive.force_always_local(vec!["non-existent".to_string()]), + Err(HiveLibError::HiveInitialisationError( + HiveInitialisationError::NodeDoesNotExist(node) + )) if node == "non-existent" ); for node in hive.nodes.values() { diff --git a/wire/lib/src/commands/pty/mod.rs b/wire/lib/src/commands/pty/mod.rs --- a/wire/lib/src/commands/pty/mod.rs +++ b/wire/lib/src/commands/pty/mod.rs @@ -307,7 +307,7 @@ let mut command = if let Some(target) = arguments.target { let mut command = create_int_ssh_command(target, arguments.modifiers)?; - // force ssh to use our pesudo terminal + // force ssh to use our pseudo terminal command.arg("-tt"); command diff --git a/wire/lib/src/hive/steps/keys.rs b/wire/lib/src/hive/steps/keys.rs --- a/wire/lib/src/hive/steps/keys.rs +++ b/wire/lib/src/hive/steps/keys.rs @@ -144,7 +144,7 @@ length: buf .len() .try_into() - .expect("Failed to conver usize buf length to i32"), + .expect("Failed to convert usize buf length to i32"), user: key.user.clone(), group: key.group.clone(), permissions: get_u32_permission(key)?, -- tangled.sh