Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo committed Aug 16, 2024
1 parent 93c4ab6 commit 9359c5d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion zk_toolbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ tokio = { version = "1.37", features = ["full"] }
toml = "0.8.12"
url = { version = "2.5.0", features = ["serde"] }
xshell = "0.2.6"
clap-markdown = "0.1.4"
clap-markdown = "0.1.4"
2 changes: 1 addition & 1 deletion zk_toolbox/crates/zk_supervisor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ url.workspace = true
xshell.workspace = true
serde.workspace = true
clap-markdown.workspace = true
futures.workspace = true
futures.workspace = true
9 changes: 6 additions & 3 deletions zk_toolbox/crates/zk_supervisor/src/commands/fmt.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{env::args, ffi::OsStr, future, path::PathBuf, process::Command};
use std::path::PathBuf;

use clap::Parser;
use common::{cmd::Cmd, logger, spinner::Spinner};
Expand All @@ -9,7 +9,6 @@ use crate::commands::lint::Extension;
const CONFIG_PATH: &str = "etc/prettier-config";

async fn prettier(shell: Shell, extension: Extension, check: bool) -> anyhow::Result<()> {
let spinner = Spinner::new(&format!("Running prettier for: {extension}"));
let mode = if check { "--check" } else { "--write" };
let glob = format!("**/*.{extension}");
let config = format!("etc/prettier-config/{extension}.js");
Expand All @@ -29,7 +28,6 @@ async fn prettier_contracts(shell: Shell, check: bool) -> anyhow::Result<()> {

async fn rustfmt(shell: Shell, check: bool, link_to_code: PathBuf) -> anyhow::Result<()> {
for dir in vec![".", "prover", "zk_toolbox"] {
logger::info(format!("Running rustfmt for: {dir}"));
let _dir = shell.push_dir(link_to_code.join(dir));
let mut cmd = cmd!(shell, "cargo fmt -- --config imports_granularity=Crate --config group_imports=StdExternalCrate");
if check {
Expand Down Expand Up @@ -74,6 +72,8 @@ pub async fn run(shell: Shell, args: FmtArgs) -> anyhow::Result<()> {
let mut tasks = vec![];
let extensions: Vec<_> =
vec![Extension::Js, Extension::Ts, Extension::Md, Extension::Sol];
let spinner =
Spinner::new(&format!("Running prettier for: {extensions:?} and rustfmt"));
for ext in extensions {
tasks.push(tokio::spawn(prettier(shell.clone(), ext, args.check)));
}
Expand All @@ -89,14 +89,17 @@ pub async fn run(shell: Shell, args: FmtArgs) -> anyhow::Result<()> {
logger::error(err)
}
});
spinner.finish()
}
Some(Formatter::Prettier { mut extensions }) => {
if extensions.is_empty() {
extensions = vec![Extension::Js, Extension::Ts, Extension::Md, Extension::Sol];
}
let spinner = Spinner::new(&format!("Running prettier for: {extensions:?}"));
for ext in extensions {
prettier(shell.clone(), ext, args.check).await?
}
spinner.finish()
}
Some(Formatter::Rustfmt) => {
run_all_rust_formatters(shell.clone(), args.check, ".".into()).await?
Expand Down
4 changes: 2 additions & 2 deletions zk_toolbox/crates/zk_supervisor/src/commands/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::messages::{
MSG_LINT_CONFIG_PATH_ERR, MSG_RUNNING_CONTRACTS_LINTER_SPINNER,
};

pub const IGNORED_DIRS: [&str; 18] = [
const IGNORED_DIRS: [&str; 18] = [
"target",
"node_modules",
"volumes",
Expand All @@ -31,7 +31,7 @@ pub const IGNORED_DIRS: [&str; 18] = [
"contracts/l1-contracts/lib",
];

pub const IGNORED_FILES: [&str; 4] = [
const IGNORED_FILES: [&str; 4] = [
"KeysWithPlonkVerifier.sol",
"TokenInit.sol",
".tslintrc.js",
Expand Down

0 comments on commit 9359c5d

Please sign in to comment.