Skip to content

Commit

Permalink
fix: use consistent verb tense for progress bars (#3109)
Browse files Browse the repository at this point in the history
* fix: use consistent verb tense for progress bar

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
jdx and autofix-ci[bot] authored Nov 21, 2024
1 parent ce4b2e2 commit 75051b0
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 50 deletions.
1 change: 1 addition & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:
CARGO_TERM_COLOR: always
MISE_TRUSTED_CONFIG_PATHS: ${{ github.workspace }}
MISE_EXPERIMENTAL: 1
MISE_LOCKFILE: 1
RUST_BACKTRACE: 1
NPM_CONFIG_FUND: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ allow = [
"MPL-2.0",
"OpenSSL",
"Unicode-3.0",
"Unicode-DFS-2016",
]
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the
Expand Down
6 changes: 6 additions & 0 deletions mise.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
version = "1.7.4"

[tools.actionlint.checksums]
actionlint-linux-x86_64 = "sha256:39cae525cdb54af5d91dcf27f55e040d37ecea01dd4153490c4dc84f5d251d46"
actionlint-macos-aarch64 = "sha256:f381afca13b39e095e4cee25e2b2abbb39ae8b2848f5ccd2564bf86192c1b661"

[tools.bun]
version = "1.1.36"

[tools.bun.checksums]
"bun-darwin-aarch64.zip" = "sha256:f299aaf467ec8e610bbefef8b91664ab3b199a174ceb2f5a97d624c96dfde068"
"bun-linux-x64-baseline.zip" = "sha256:515666143dbda58ed0b90cf3ae0ade7178b0d705d7576f62bedf66c709740eb3"

[tools.cargo-binstall]
version = "1.10.13"

[tools.cargo-binstall.checksums]
cargo-binstall-linux-x86_64 = "sha256:53a7157f56e1698d42d3cd50b1d08f02159638e3a73edf362e14215337942e86"
cargo-binstall-macos-aarch64 = "sha256:f67dd4fc8ea01b4c55fe041a0fbd6d81a361947f1dbf2bd226490c641cc167b3"

[tools."cargo:cargo-edit"]
Expand All @@ -35,6 +38,7 @@ version = "1.3.2"
version = "1.7.1"

[tools.jq.checksums]
jq-linux-amd64 = "sha256:5942c9b0934e510ee61eb3e30273f1b3fe2590df93933a93d7c58b81d19c8ff5"
jq-macos-arm64 = "sha256:0bbe619e663e0de2c550be2fe0d240d076799d6f8a652b70fa04aea8a8362e8a"

[tools."npm:markdownlint-cli"]
Expand All @@ -51,11 +55,13 @@ version = "14.1.1"

[tools.ripgrep.checksums]
"ripgrep-14.1.1-aarch64-apple-darwin.tar.gz" = "sha256:24ad76777745fbff131c8fbc466742b011f925bfa4fffa2ded6def23b5b937be"
"ripgrep-14.1.1-x86_64-unknown-linux-musl.tar.gz" = "sha256:4cf9f2741e6c465ffdb7c26f38056a59e2a2544b51f7cc128ef28337eeae4d8e"

[tools.shellcheck]
version = "0.10.0"

[tools.shellcheck.checksums]
shellcheck-linux-x86_64 = "sha256:f35ae15a4677945428bdfe61ccc297490d89dd1e544cc06317102637638c6deb"
shellcheck-macos-aarch64 = "sha256:b9e420df8c78ec7d261d66277d5767cbd4cf6da4e4a9f8b02ea4811cd4cc1109"

[tools.shfmt]
Expand Down
4 changes: 2 additions & 2 deletions src/backend/aqua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl AquaBackend {
if tarball_path.exists() {
return Ok(());
}
ctx.pr.set_message(format!("downloading {filename}"));
ctx.pr.set_message(format!("download {filename}"));
HTTP.download_file(url, &tarball_path, Some(ctx.pr.as_ref()))?;
Ok(())
}
Expand Down Expand Up @@ -297,7 +297,7 @@ impl AquaBackend {
filename: &str,
) -> Result<()> {
let tarball_path = tv.download_path().join(filename);
ctx.pr.set_message(format!("installing {filename}"));
ctx.pr.set_message(format!("extract {filename}"));
let install_path = tv.install_path();
file::remove_all(&install_path)?;
let format = pkg.format(v)?;
Expand Down
4 changes: 2 additions & 2 deletions src/backend/asdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ impl Backend for AsdfBackend {
let run_script = |script| sm.run_by_line(script, ctx.pr.as_ref());

if sm.script_exists(&Download) {
ctx.pr.set_message("downloading".into());
ctx.pr.set_message("bin/download".into());
run_script(&Download)?;
}
ctx.pr.set_message("installing".into());
ctx.pr.set_message("bin/install".into());
run_script(&Install)?;
file::remove_dir(&self.ba.downloads_path)?;

Expand Down
9 changes: 4 additions & 5 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ pub trait Backend: Debug + Send + Sync {
return Ok(tv);
}
}
ctx.pr.set_message("installing".into());
ctx.pr.set_message("install".into());
let _lock = lock_file::get(&tv.install_path(), ctx.force)?;
self.create_install_dirs(&tv)?;

Expand Down Expand Up @@ -442,7 +442,7 @@ pub trait Backend: Debug + Send + Sync {
if !dir.exists() {
return Ok(());
}
pr.set_message(format!("removing {}", display_path(dir)));
pr.set_message(format!("remove {}", display_path(dir)));
if dryrun {
return Ok(());
}
Expand Down Expand Up @@ -609,8 +609,7 @@ pub trait Backend: Debug + Send + Sync {
bail!("Invalid checksum: {checksum}");
}
} else if SETTINGS.lockfile && SETTINGS.experimental {
ctx.pr
.set_message(format!("generating checksum {filename}"));
ctx.pr.set_message(format!("generate checksum {filename}"));
let hash = hash::file_hash_prog::<Sha256>(file, Some(ctx.pr.as_ref()))?;
tv.checksums.insert(filename, format!("sha256:{hash}"));
}
Expand All @@ -629,7 +628,7 @@ fn rmdir(dir: &Path, pr: &dyn SingleReport) -> eyre::Result<()> {
if !dir.exists() {
return Ok(());
}
pr.set_message(format!("removing {}", &dir.to_string_lossy()));
pr.set_message(format!("remove {}", &dir.to_string_lossy()));
remove_all(dir).wrap_err_with(|| {
format!(
"Failed to remove directory {}",
Expand Down
5 changes: 3 additions & 2 deletions src/backend/ubi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,16 @@ impl Backend for UbiBackend {
}
checksum_key = format!("{}-{}-{}", checksum_key, env::consts::OS, env::consts::ARCH);
if let Some(checksum) = &tv.checksums.get(&checksum_key) {
ctx.pr.set_message(format!("checksum {checksum_key}"));
ctx.pr
.set_message(format!("checksum verify {checksum_key}"));
if let Some((algo, check)) = checksum.split_once(':') {
hash::ensure_checksum(file, check, Some(ctx.pr.as_ref()), algo)?;
} else {
bail!("Invalid checksum: {checksum_key}");
}
} else if SETTINGS.lockfile && SETTINGS.experimental {
ctx.pr
.set_message(format!("generating checksum {checksum_key}"));
.set_message(format!("checksum generate {checksum_key}"));
let hash = hash::file_hash_prog::<Sha256>(file, Some(ctx.pr.as_ref()))?;
tv.checksums.insert(checksum_key, format!("sha256:{hash}"));
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl Upgrade {
}

for (o, tv) in to_remove {
let pr = mpr.add(&format!("Uninstalling {}@{}", o.name, tv));
let pr = mpr.add(&format!("uninstall {}@{}", o.name, tv));
self.uninstall_old_version(&o.tool_version, pr.as_ref())?;
}

Expand Down
2 changes: 1 addition & 1 deletion src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ pub fn untar(archive: &Path, dest: &Path, opts: &TarOptions) -> Result<()> {
debug!("tar -xf {} -C {}", archive.display(), dest.display());
if let Some(pr) = &opts.pr {
pr.set_message(format!(
"extracting {}",
"extract {}",
archive.file_name().unwrap().to_string_lossy()
));
}
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/asdf_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl AsdfPlugin {
let mut sm = self.script_man.clone();
sm.env.extend(env);
if sm.script_exists(&script) {
pr.set_message(format!("executing {hook} hook"));
pr.set_message(format!("bin/{hook}"));
sm.run_by_line(&script, pr)?;
}
Ok(())
Expand Down Expand Up @@ -276,7 +276,7 @@ impl Plugin for AsdfPlugin {
);
return Ok(());
}
pr.set_message("updating git repo".into());
pr.set_message("update git repo".into());
let (pre, post) = git.update(gitref)?;
let sha = git.current_sha_short()?;
let repo_url = self.get_remote_url()?.unwrap_or_default();
Expand All @@ -293,13 +293,13 @@ impl Plugin for AsdfPlugin {
return Ok(());
}
self.exec_hook(pr, "pre-plugin-remove")?;
pr.set_message("uninstalling".into());
pr.set_message("uninstall".into());

let rmdir = |dir: &Path| {
if !dir.exists() {
return Ok(());
}
pr.set_message(format!("removing {}", display_path(dir)));
pr.set_message(format!("remove {}", display_path(dir)));
remove_all(dir).wrap_err_with(|| {
format!(
"Failed to remove directory {}",
Expand Down Expand Up @@ -331,10 +331,10 @@ Plugins could support local directories in the future but for now a symlink is r
))?;
}
let git = Git::new(&self.plugin_path);
pr.set_message(format!("cloning {repo_url}"));
pr.set_message(format!("clone {repo_url}"));
git.clone(&repo_url)?;
if let Some(ref_) = &repo_ref {
pr.set_message(format!("checking out {ref_}"));
pr.set_message(format!("check out {ref_}"));
git.update(Some(ref_.to_string()))?;
}
self.exec_hook(pr, "post-plugin-add")?;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/core/bun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ impl BunPlugin {
let filename = url.split('/').last().unwrap();
let tarball_path = tv.download_path().join(filename);

pr.set_message(format!("downloading {filename}"));
pr.set_message(format!("download {filename}"));
HTTP.download_file(&url, &tarball_path, Some(pr))?;

Ok(tarball_path)
}

fn install(&self, ctx: &InstallContext, tv: &ToolVersion, tarball_path: &Path) -> Result<()> {
let filename = tarball_path.file_name().unwrap().to_string_lossy();
ctx.pr.set_message(format!("installing {filename}"));
ctx.pr.set_message(format!("extract {filename}"));
file::remove_all(tv.install_path())?;
file::create_dir_all(tv.install_path().join("bin"))?;
file::unzip(tarball_path, &tv.download_path())?;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/core/deno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl DenoPlugin {
let filename = url.split('/').last().unwrap();
let tarball_path = tv.download_path().join(filename);

pr.set_message(format!("downloading {filename}"));
pr.set_message(format!("download {filename}"));
HTTP.download_file(&url, &tarball_path, Some(pr))?;

// TODO: hash::ensure_checksum_sha256(&tarball_path, &m.sha256)?;
Expand All @@ -65,7 +65,7 @@ impl DenoPlugin {

fn install(&self, tv: &ToolVersion, pr: &dyn SingleReport, tarball_path: &Path) -> Result<()> {
let filename = tarball_path.file_name().unwrap().to_string_lossy();
pr.set_message(format!("installing {filename}"));
pr.set_message(format!("extract {filename}"));
file::remove_all(tv.install_path())?;
file::create_dir_all(tv.install_path().join("bin"))?;
file::unzip(tarball_path, &tv.download_path())?;
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/core/go.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl GoPlugin {
if package.is_empty() {
continue;
}
pr.set_message(format!("installing default package: {}", package));
pr.set_message(format!("install default package: {}", package));
let package = if package.contains('@') {
package.to_string()
} else {
Expand Down Expand Up @@ -102,7 +102,7 @@ impl GoPlugin {
let checksum_url = format!("{}.sha256", &tarball_url);
HTTP.get_text(checksum_url)
});
pr.set_message(format!("downloading {filename}"));
pr.set_message(format!("download {filename}"));
HTTP.download_file(&tarball_url, &tarball_path, Some(pr))?;

if !settings.go_skip_checksum && !tv.checksums.contains_key(&filename) {
Expand All @@ -123,7 +123,7 @@ impl GoPlugin {
.file_name()
.unwrap_or_default()
.to_string_lossy();
pr.set_message(format!("installing {}", tarball));
pr.set_message(format!("extract {}", tarball));
let tmp_extract_path = tempdir_in(tv.install_path().parent().unwrap())?;
if cfg!(windows) {
file::unzip(tarball_path, tmp_extract_path.path())?;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/core/java.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl JavaPlugin {
let filename = m.url.split('/').last().unwrap();
let tarball_path = tv.download_path().join(filename);

pr.set_message(format!("downloading {filename}"));
pr.set_message(format!("download {filename}"));
HTTP.download_file(&m.url, &tarball_path, Some(pr))?;

if !tv.checksums.contains_key(filename) {
Expand All @@ -118,7 +118,7 @@ impl JavaPlugin {
m: &JavaMetadata,
) -> Result<()> {
let filename = tarball_path.file_name().unwrap().to_string_lossy();
pr.set_message(format!("installing {filename}"));
pr.set_message(format!("extract {filename}"));
if m.file_type
.as_ref()
.is_some_and(|file_type| file_type == "zip")
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/core/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl NodePlugin {
e => e,
}?;
let tarball_name = &opts.binary_tarball_name;
ctx.pr.set_message(format!("extracting {tarball_name}"));
ctx.pr.set_message(format!("extract {tarball_name}"));
file::remove_all(&opts.install_path)?;
file::untar(
&opts.binary_tarball_path,
Expand Down Expand Up @@ -91,7 +91,7 @@ impl NodePlugin {
e => e,
}?;
let tarball_name = &opts.binary_tarball_name;
ctx.pr.set_message(format!("extracting {tarball_name}"));
ctx.pr.set_message(format!("extract {tarball_name}"));
let tmp_extract_path = tempdir_in(opts.install_path.parent().unwrap())?;
file::unzip(&opts.binary_tarball_path, tmp_extract_path.path())?;
file::remove_all(&opts.install_path)?;
Expand All @@ -117,7 +117,7 @@ impl NodePlugin {
&opts.source_tarball_path,
&opts.version,
)?;
ctx.pr.set_message(format!("extracting {tarball_name}"));
ctx.pr.set_message(format!("extract {tarball_name}"));
file::remove_all(&opts.build_dir)?;
file::untar(
&opts.source_tarball_path,
Expand Down Expand Up @@ -147,7 +147,7 @@ impl NodePlugin {
if local.exists() {
pr.set_message(format!("using previously downloaded {tarball_name}"));
} else {
pr.set_message(format!("downloading {tarball_name}"));
pr.set_message(format!("download {tarball_name}"));
HTTP.download_file(url.clone(), local, Some(pr))?;
}
if *env::MISE_NODE_VERIFY && !tv.checksums.contains_key(&tarball_name) {
Expand Down Expand Up @@ -225,7 +225,7 @@ impl NodePlugin {
if package.is_empty() {
continue;
}
pr.set_message(format!("installing default package: {}", package));
pr.set_message(format!("install default package: {}", package));
let npm = self.npm_path(tv);
CmdLineRunner::new(npm)
.with_pr(pr)
Expand All @@ -247,7 +247,7 @@ impl NodePlugin {
}

fn enable_default_corepack_shims(&self, tv: &ToolVersion, pr: &dyn SingleReport) -> Result<()> {
pr.set_message("enabling corepack shims".into());
pr.set_message("enable corepack shims".into());
let corepack = self.corepack_path(tv);
CmdLineRunner::new(corepack)
.with_pr(pr)
Expand Down
7 changes: 3 additions & 4 deletions src/plugins/core/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,9 @@ impl PythonPlugin {
let download = tv.download_path();
let tarball_path = download.join(filename);

ctx.pr.set_message(format!("downloading {filename}"));
ctx.pr.set_message(format!("download {filename}"));
HTTP.download_file(&url, &tarball_path, Some(ctx.pr.as_ref()))?;

ctx.pr.set_message(format!("installing {filename}"));
file::remove_all(&install)?;
file::untar(
&tarball_path,
Expand All @@ -204,7 +203,7 @@ impl PythonPlugin {
if matches!(&tv.request, ToolRequest::Ref { .. }) {
return Err(eyre!("Ref versions not supported for python"));
}
ctx.pr.set_message("Running python-build".into());
ctx.pr.set_message("python-build".into());
let mut cmd = CmdLineRunner::new(self.python_build_bin())
.with_pr(ctx.pr.as_ref())
.arg(tv.version.as_str())
Expand Down Expand Up @@ -245,7 +244,7 @@ impl PythonPlugin {
if !packages_file.exists() {
return Ok(());
}
pr.set_message("installing default packages".into());
pr.set_message("install default packages".into());
CmdLineRunner::new(tv.install_path().join("bin/python"))
.with_pr(pr)
.arg("-m")
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/core/ruby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl RubyPlugin {
if package.is_empty() {
continue;
}
pr.set_message(format!("installing default gem: {}", package));
pr.set_message(format!("install default gem: {}", package));
let gem = self.gem_path(tv);
let mut cmd = CmdLineRunner::new(gem)
.with_pr(pr)
Expand Down Expand Up @@ -374,7 +374,7 @@ impl Backend for RubyPlugin {
if let Err(err) = self.update_build_tool() {
warn!("ruby build tool update error: {err:#}");
}
ctx.pr.set_message("running ruby-build".into());
ctx.pr.set_message("ruby-build".into());
let config = Config::get();
self.install_cmd(&config, &tv, ctx.pr.as_ref())?.execute()?;

Expand Down
Loading

0 comments on commit 75051b0

Please sign in to comment.