From e7c573cfcb069cc940b8838ecb5f8d1e4858c304 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sun, 9 Jun 2024 18:50:54 -0700 Subject: [PATCH] Fix existing typos and enable `typos` in CI (#4184) --- .github/workflows/ci.yml | 6 ++++++ CHANGELOG.md | 2 +- _typos.toml | 2 ++ crates/install-wheel-rs/src/uninstall.rs | 4 ++-- crates/uv-resolver/src/resolver/mod.rs | 4 ++-- crates/uv-toolchain/src/lib.rs | 6 +++--- crates/uv-toolchain/src/toolchain.rs | 2 +- crates/uv/src/commands/tool/run.rs | 4 ++-- crates/uv/tests/pip_install_scenarios.rs | 4 ++-- crates/uv/tests/venv.rs | 2 +- 10 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34a1767bc..426fc4047 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -291,6 +291,12 @@ jobs: RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup run: cargo build --release --target x86_64-pc-windows-msvc + typos: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@master + build-binary-linux: runs-on: labels: ubuntu-latest-large diff --git a/CHANGELOG.md b/CHANGELOG.md index 0aab1b8ce..b7bbcfc6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ ### Bug fixes -- Fix `uv venv` handling when `VIRTUAL_ENV` refers to an non-existant environment ([#4073](https://github.com/astral-sh/uv/pull/4073)) +- Fix `uv venv` handling when `VIRTUAL_ENV` refers to an non-existent environment ([#4073](https://github.com/astral-sh/uv/pull/4073)) ## 0.2.7 diff --git a/_typos.toml b/_typos.toml index 8bac262cf..eb5fee45a 100644 --- a/_typos.toml +++ b/_typos.toml @@ -11,6 +11,8 @@ extend-ignore-re = [ "FrIeNdLy-\\._\\.-bArD", "I borken you cache", "eb1ba5f5", + "github_pat_[0-9a-zA-Z_]+", + "LICENSEs", ] [default.extend-identifiers] diff --git a/crates/install-wheel-rs/src/uninstall.rs b/crates/install-wheel-rs/src/uninstall.rs index 35bc54869..45063f955 100644 --- a/crates/install-wheel-rs/src/uninstall.rs +++ b/crates/install-wheel-rs/src/uninstall.rs @@ -179,8 +179,8 @@ pub fn uninstall_egg(egg_info: &Path) -> Result { } // Remove as a `.py`, `.pyc`, or `.pyo` file. - for exten in &["py", "pyc", "pyo"] { - let path = path.with_extension(exten); + for extension in &["py", "pyc", "pyo"] { + let path = path.with_extension(extension); match fs_err::remove_file(&path) { Ok(()) => { debug!("Removed file: {}", path.display()); diff --git a/crates/uv-resolver/src/resolver/mod.rs b/crates/uv-resolver/src/resolver/mod.rs index 1125e8f20..e9eba5413 100644 --- a/crates/uv-resolver/src/resolver/mod.rs +++ b/crates/uv-resolver/src/resolver/mod.rs @@ -1712,8 +1712,8 @@ impl<'a> From> for Request { // N.B. This is almost identical to `ResolvedDistRef::to_owned`, but // creates a `Request` instead of a `ResolvedDist`. There's probably // some room for DRYing this up a bit. The obvious way would be to - // add a method to create a `Dist`, but a `Dist` cannot reprented an - // installed dist. + // add a method to create a `Dist`, but a `Dist` cannot be represented + // as an installed dist. match dist { ResolvedDistRef::InstallableRegistrySourceDist { sdist, prioritized } => { // This is okay because we're only here if the prioritized dist diff --git a/crates/uv-toolchain/src/lib.rs b/crates/uv-toolchain/src/lib.rs index 1b6059224..6fcbed5cb 100644 --- a/crates/uv-toolchain/src/lib.rs +++ b/crates/uv-toolchain/src/lib.rs @@ -150,7 +150,7 @@ mod tests { let mut run_vars = vec![ // Ensure `PATH` is used ("UV_TEST_PYTHON_PATH", None), - // Ignore active virtual envrionments (i.e. that the dev is using) + // Ignore active virtual environments (i.e. that the dev is using) ("VIRTUAL_ENV", None), ("PATH", path.as_deref()), // Use the temporary toolchain directory @@ -1292,7 +1292,7 @@ mod tests { assert_eq!( toolchain.interpreter().python_full_version().to_string(), "3.10.0", - "We should find the named executbale" + "We should find the named executable" ); let result = context.run(|| { @@ -1478,7 +1478,7 @@ mod tests { "We should find the absolute venv path" ); - // We should allow it to be a directory that _looks_ like a virtual environmnet + // We should allow it to be a directory that _looks_ like a virtual environment. let python = context.tempdir.child("bar").join("bin").join("python"); TestContext::create_mock_interpreter( &python, diff --git a/crates/uv-toolchain/src/toolchain.rs b/crates/uv-toolchain/src/toolchain.rs index 0c254d359..65809c0c3 100644 --- a/crates/uv-toolchain/src/toolchain.rs +++ b/crates/uv-toolchain/src/toolchain.rs @@ -33,7 +33,7 @@ impl Toolchain { } else if system.is_preferred() { Self::find_default(preview, cache) } else { - // First check for a parent intepreter + // First check for a parent interpreter // We gate this check to avoid an extra log message when it is not set if std::env::var_os("UV_INTERNAL__PARENT_INTERPRETER").is_some() { match Self::find_parent_interpreter(system, cache) { diff --git a/crates/uv/src/commands/tool/run.rs b/crates/uv/src/commands/tool/run.rs index 546681d8e..679dee161 100644 --- a/crates/uv/src/commands/tool/run.rs +++ b/crates/uv/src/commands/tool/run.rs @@ -45,8 +45,8 @@ pub(crate) async fn run( .chain(with.into_iter().map(RequirementsSource::from_package)) .collect::>(); - // TODO(zanieb): When implementing project-level tools, discover the project and check if it has the tool - // TOOD(zanieb): Determine if we sould layer on top of the project environment if it is present + // TODO(zanieb): When implementing project-level tools, discover the project and check if it has the tool. + // TODO(zanieb): Determine if we should layer on top of the project environment if it is present. // If necessary, create an environment for the ephemeral requirements. debug!("Syncing ephemeral environment."); diff --git a/crates/uv/tests/pip_install_scenarios.rs b/crates/uv/tests/pip_install_scenarios.rs index 5785581a8..bb6404c4d 100644 --- a/crates/uv/tests/pip_install_scenarios.rs +++ b/crates/uv/tests/pip_install_scenarios.rs @@ -501,7 +501,7 @@ fn dependency_excludes_range_of_compatible_versions() { /// There is a non-contiguous range of compatible versions for the requested package /// `a`, but another dependency `c` excludes the range. This is the same as /// `dependency-excludes-range-of-compatible-versions` but some of the versions of -/// `a` are incompatible for another reason e.g. dependency on non-existant package +/// `a` are incompatible for another reason e.g. dependency on non-existent package /// `d`. /// /// ```text @@ -3530,7 +3530,7 @@ fn package_only_prereleases_boundary() { "###); // Since there are only prerelease versions of `a` available, a prerelease is - // allowed. Since the user did not explictly request a pre-release, pre-releases at + // allowed. Since the user did not explicitly request a pre-release, pre-releases at // the boundary should not be selected. assert_installed( &context.venv, diff --git a/crates/uv/tests/venv.rs b/crates/uv/tests/venv.rs index 8a89c0dde..e66e9f89d 100644 --- a/crates/uv/tests/venv.rs +++ b/crates/uv/tests/venv.rs @@ -164,7 +164,7 @@ fn create_venv_defaults_to_cwd() { #[test] fn create_venv_ignores_virtual_env_variable() { let context = VenvTestContext::new(&["3.12"]); - // We shouldn't care if `VIRTUAL_ENV` is set to an non-existant directory + // We shouldn't care if `VIRTUAL_ENV` is set to an non-existent directory // because we ignore virtual environment interpreter sources (we require a system interpreter) uv_snapshot!(context.filters(), context.venv_command() .env("VIRTUAL_ENV", context.temp_dir.child("does-not-exist").as_os_str()), @r###"