diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 764b85baccaf..dba6efd2fdff 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -18,4 +18,3 @@ - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`. -- [ ] Spellcheck has been run via `zk spellcheck`. diff --git a/.github/workflows/check-spelling.yml b/.github/workflows/check-spelling.yml deleted file mode 100644 index 8ffa29c1ea9b..000000000000 --- a/.github/workflows/check-spelling.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Check Spelling - -on: - push: - branches: - - main - pull_request: - merge_group: - -env: - CARGO_TERM_COLOR: always - -jobs: - spellcheck: - runs-on: [matterlabs-ci-runner] - steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - with: - submodules: "recursive" - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Setup environment - run: | - echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV - echo $(pwd)/bin >> $GITHUB_PATH - echo IN_DOCKER=1 >> .env - - - name: Start services - run: | - run_retried docker compose pull zk - docker compose up -d zk - - - name: Build zk - run: | - ci_run zk - - - name: Run spellcheck - run: | - ci_run zk spellcheck diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2676289d0f3a..0791a311fed3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,8 +52,6 @@ Be polite and respectful. **Q**: I have a small contribution that's not getting traction/being merged? **A**: Due to capacity, contributions that are simple renames of variables or stylistic/minor text improvements, one-off -typo fix will not be merged. If you do find any typos or grammar errors, the preferred avenue is to improve the existing -spellchecker. Given you have no technical prowess to do so, please create an issue. Please note that issues will be -resolved on a best effort basis. +typo fix will not be merged. ### Thank you diff --git a/checks-config/cspell.json b/checks-config/cspell.json deleted file mode 100644 index bafb5e036d04..000000000000 --- a/checks-config/cspell.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "language": "en", - "ignorePaths": [ - "**/CHANGELOG.md", - "**/node_modules/**", - ".github/**", - ".firebase/**", - ".yarn/**", - "dist/**", - "**/contracts/**", - "**/target/**" - ], - "dictionaries": [ - "typescript", - "cpp", - "npm", - "filetypes", - "cpp", - "en_GB", - "en_US", - "node", - "bash", - "fonts", - "npm", - "cryptocurrencies", - "companies", - "rust", - "html", - "css", - "entities", - "softwareTerms", - "misc", - "fullstack", - "softwareTerms", - "zksync", - "nuxt", - "viem" - ], - "dictionaryDefinitions": [ - { - "name": "zksync", - "addWords": true, - "path": "./era.dic" - } - ], - "allowCompoundWords": true - } \ No newline at end of file diff --git a/checks-config/era.cfg b/checks-config/era.cfg deleted file mode 100644 index c8a6baba820a..000000000000 --- a/checks-config/era.cfg +++ /dev/null @@ -1,69 +0,0 @@ -# Project settings where a Cargo.toml exists and is passed -# ${CARGO_MANIFEST_DIR}/.config/spellcheck.toml - -# Also take into account developer comments -dev_comments = true - -# Skip the README.md file as defined in the cargo manifest -skip_readme = false - -[Hunspell] -# lang and name of `.dic` file -lang = "en_US" -# OS specific additives -# Linux: [ /usr/share/myspell ] -# Windows: [] -# macOS [ /home/alice/Libraries/hunspell, /Libraries/hunspell ] - -# Additional search paths, which take precedence over the default -# os specific search dirs, searched in order, defaults last -search_dirs = ["."] - -# Adds additional dictionaries, can be specified as -# absolute paths or relative in the search dirs (in this order). -# Relative paths are resolved relative to the configuration file -# which is used. -# Refer to `man 5 hunspell` -# or https://www.systutorials.com/docs/linux/man/4-hunspell/#lbAE -# on how to define a custom dictionary file. -extra_dictionaries = ["era.dic"] - -# If set to `true`, the OS specific default search paths -# are skipped and only explicitly specified ones are used. -skip_os_lookups = false - -# Use the builtin dictionaries if none were found in -# in the configured lookup paths. -# Usually combined with `skip_os_lookups=true` -# to enforce the `builtin` usage for consistent -# results across distributions and CI runs. -# Setting this will still use the dictionaries -# specified in `extra_dictionaries = [..]` -# for topic specific lingo. -use_builtin = true - - -[Hunspell.quirks] -# Transforms words that are provided by the tokenizer -# into word fragments based on the capture groups which are to -# be checked. -# If no capture groups are present, the matched word is whitelisted. -transform_regex = ["^'([^\\s])'$", "^[0-9]+x$"] -# Accepts `alphabeta` variants if the checker provides a replacement suggestion -# of `alpha-beta`. -allow_concatenation = true -# And the counterpart, which accepts words with dashes, when the suggestion has -# recommendations without the dashes. This is less common. -allow_dashed = false - -[NlpRules] -# Allows the user to override the default included -# exports of LanguageTool, with other custom -# languages - -# override_rules = "/path/to/rules_binencoded.bin" -# override_tokenizer = "/path/to/tokenizer_binencoded.bin" - -[Reflow] -# Reflows doc comments to adhere to a given maximum line width limit. -max_line_length = 80 diff --git a/checks-config/era.dic b/checks-config/era.dic deleted file mode 100644 index 3f4c8fc8fa4f..000000000000 --- a/checks-config/era.dic +++ /dev/null @@ -1,984 +0,0 @@ -42 -<= -=> -== --> -<- -+ -- -* -\ -= -/ -|| -< -> -% -^ -0x00 -0x01 -0x02 -0x20 -~10x -u32 -u64 -u8 -1B -H256 -10e18 -10^9 -2^32 -2^128 -2^24 -10^32 -10^* -2^16 -2^64 -10^8 -U256 -12.5% -5% -10% -20% -*% -90% -1% -f64 -k -M -kb -Gbps -50M -2M -130µs -– -18kb -128kb -10k -100k -120k -800k -24k -500k -50k -52k -260k -120kb -18kb -12GB -20GB -500B -100M -~100us -10ms -1_000ms -1us -~100 -gwei - -ABI -vlog -const -L2 -L2s -L1 -json -l1 -l2 -G1 -G2 -SystemConfig -TODO -se -ZKSYNC_HOME -MultiVMTracer -vm_virtual_blocks -eth_node -EthCall -BaseSystemContracts -eth_calls -refactor -WS -env -url -GasAdjuster -base_fee -base_fee_per_gas -ERC20 -Finalizer -Backoff -middleware -parallelization -precompute -precomputed -Postgres -parallelized -parallelize -job_id -API -APIs -async -pointwise -observability -atomics -integrations -stdout -GCS -websocket -struct -struct's -localhost -TOML -config -finalizer -boolean -prover -timestamp -H160 -ZKsync -AccessList -miniblock -member₁ -member₂ -memberₙ -merkle -eth -Ethereum -deployer -designator -designators -RPC -tx -txs -subtrees -subtree -unfinalizable -meterer -Timedout -bootloader -bootloader's -testkit -Sepolia -Goerli -miniblock -miniblocks -MempoolIO -mempool -latencies -OracleTools -StorageOracle -zk_evm -zkEVM -src -utils -ptr -recurse -RefCell -Rc -StorageView -VM_HOOK_POSITION -VM_HOOKS_PARAMS_COUNT -PAYMASTER_CONTEXT_SLOTS -PrecompilerProcessor -MAX_POSTOP_SLOTS -postOp -type -opcode -KnownCodesStorage -param -HistoryDisabled -HistoryEnabled -sorted_timestamps -known_bytecodes -returndata -namespaces -natively -StateDiffRecord -BYTES_PER_ENUMERATION_INDEX -derived_key -prefill -reorg -precompile -Init -init -enqueued -stage2 -testnets -ethCalls -generable -Serde -tokenize -EOAs -zeroized -cardinality - -// ZKsync-related words -matterlabs -zkweb -zksync -blockchain -zkscan -zkscrypto -PubSub -loadtest -BigUint -radix -state_keeper -MIN_PAYMASTER_BALANCE -PrometheusCollector -RetryCollector -ScriptCollector -MetricsCollector -OperationResultsCollector -ReportCollector -filesystem -hasher -Hasher -grafana -prometheus -serializer -serializable -deserializer -Deserializes -deserializes -serializing -deserializing -deserialization -configs -operation_number -hashed_key -deduplication -mutexes -mutex -Blake2s -Blake2 -web3 -Testnets -miniblock_number -hashed_key -tuples -\x19Ethereum -libzkscrypto -EOA -MultiVM -nonces -fri -rollup -pubkey -JSON -keccak256 -pubdata -timestamps -keccak -musig -len -calldata -DApp -metadata -boojum -deps -Precalculated -precalculated -WASM -DefaultPrecompilesProcessor -LSB -DDoS -refactored -tuple -HistoryMode -vm -VM -VMs -VM's -MSB -Enum -PublishProof -jsrpc -backends -ethsig -ethop -decentralization -rollups -zkrollup -unencrypted -permissionless -trustlessness -IERC -Schnorr -MuSig -Merkle -decentralised -mainchain -offchain -processed -zcli -blockchains -sidechain -sidechains -tokenomics -validator -validator's -validator -validators -Validators -CHAINID -PREVRANDAO -ECDSA -EIP712 -EIP1559 -EIPs -eth_estimateGas -eth_call -versa -blake2 -AR16MT -Preimages -EN's -SystemContext -StorageOracle -intrinsics -chunked -chunking -deadbeef01 -deadbeef0 -deadbeef -unsynced -computable -DevEx -Workspace -NFT -preimage -subcalls -hashmaps -monotonicity -subquery -RPCs -programmatically -stdin -stderr -Linter -SmallRng -ZkPorter -StateDiffs -HashMaps -encodings -CTPOP -decommitter -Decommitter -Decommitments -Decommitment -decommitment -decommitments -Decommit -decommit -decommits -DecommiterOracle -DecommitmentProcessor -decommitted -decommit -decommitting -Demuxer -demultiplex -recid -inversed -plux -Binop -Arithmetization -arithmetization -nocapture -Plonky -permissioned -mathbb -Invb -REDC -iszero -skept -ECADD -ECMUL -preds -inttoptr -syncvm -nasm -rodata -ISZERO -JUMPI -ethir -ptrtoint -lshr -getu -zext -noprofile -umin -cccond -ccret -prodm -prodl -prodeh -prodh -interm -signv -ashr -noalias -immediates -prode -StorageBatchInfo -CommitBatchInfo -IExecutor -SetChainId -setChainId -SetChainIdUpgrade -state_transition_manager_contract -prunable -bytea - -// Names -Vyper -stimate -samount -Stichting -Kingsfordweg -RSIN -ABDK -Alef -Zcon -Paypal -Numio -MLTT -USDCs -dapi -validiums -validium -Validium -sharded -pepe -Arweave -Streamr -dutterbutter -NixOS -CLI -SQLx -Rustup -nextest -NTFS -toolchains -toolchain -IDE -M1 -M2 -MacOS -OpenSSL -Xcode -LLVM -nvm -LTS -logout -WSL -orchestrator -TypeScript -Cryptographical -cryptographical -microservices -Executables -subcomponents -v2 -v1 -rmSync -SSL -setup_2^26 -uncomment -toml -GCP -dev -workspace -subcommand -Kubernetes -Etherscan -cryptographic -hashers -MacBook -DDR5 -~ - -// Used libraries -numberish -arrayify -hexlify -markdownlint -ethersproject -nomicfoundation -nomiclabs -Consensys -zkforge -zkcast -Eigen -IPFS - -// Used programming language words -printf -charsets -println -fatalf -allowfullscreen -inttypes -zbin -Panicf -Deri -DERI -Furucombo -kwargs -scaleb -isinstance -RocksDB -mload -secp -porco -rosso -insize -MLOAD -sload -sload -uadd -nocallback -nosync -swrite -Devs -insta -NFTF -yaml - -// ETC -gitter -signup -signups -precompiled -checkmark -Vitalik -Buterin -roadmap -majeure -conveniens -reimplementing -subsecond -supermajority -gemeente -unauthorised -Ethereum's -SDKs -EVM's -EVM -Göerli -ETHUSDC -USDCUSD -ETHUS -USDCUS -ETHUSD -Arbitrum -Adamantium -Immunefi -Winternitz -ewasm -Evmla -UUPS -Uups -TLDR -BLAKE2s -bytes32 -enumeration_index -backend -enum -num_initial -to_check_storage -source_storage -prepend -deduplicated -user_l2_to_l1_logs -L1Messeger -params -provers -zk -substring -reverter -wei -deduplicate -testnet -mainnet -performant -opcodes -USDC -USD -DBs -unexecutable -RLP -DAL -ZKsync's -l2_to_l1 -PoW -coinbase -FIXME -ASC -DESC -versioning -initializer -refactoring -prefetch -unformatted - -// crypto events -Edcon - -// Famous crypto people -Gluchowski -Vitalik's -Buterin's -multisignature -onchain -convertion -Keyhash -Armeabi -scijava -gluk -@Deniallugo's -emilluta - -// Programming related words -backfill -bytecode -bytecodes -impl -subrange -timeframe -leaf_count -mkdir -librocksdb -zksolc -zksyncrobot -precompiles -vyper -zkvyper -undol -applyl -Upgradability -Initializable -Hola -mundo -ISTN -Zerion -Maverik -zk_evm_1_3_3 -vk -vks -CORS -verifier -crypto -callee -Subcalls -Vec -vec -vecs -L1Messenger -SystemL2ToL1Log -witness_inputs -StateKeeper -enum_index -virtual_block_start_batch -virtual_block_finish_l2_block -base_token_address -maxFeePerGas -maxPriorityFeePerGas -structs -all_circuit -OversizedData -M5 -eth_sign -geth -reth -ethers -js -recovery_id -&self -ETHSignature -recover_signer -BlockNumber -(de) -{result -DebugCall} -CREATE2 -memtables -memtable -PostgreSQL -OneTx -DefaultTracer -Tx1 -Tx2 -TxN -VmStopped -Unversioned -versioned -l2_block -submodule -enums -deserialized -deserialize -hashmap -vm_m5 -SDK -1M -dir -SSD -getter -Getters -WebSocket -gasLimit -MiBs -MiB -GiB -GiBs -pubsub -\x19Ethereum -nibbles–node -ZkSyncTree -invariants -LEB128 -workflow -L1Batch -runtime -Tokio -Blobstore -S3 -AWS -ExternalIO -ClosedFormInputWrapper -AggregationWrapper -(de)serializer -typesafe -LRU -ns -Q3 -loadnext -args -with_arg -node_aggregation_job -scheduler_job -leaf_aggregation_job -MAX_ATTEMPTs -fsync -TEST_DATABASE_URL -newest_block -block_count -contracts_verification_info -RNG -jsonrpsee -l1_batch -Namespace -ExecutionStatus -VmStarted -reproducibility -CFs -key–value -enum_index_migration_cursor -block_number -initial_writes -errored -FactoryDeps -de -StorageView's -Yul -eth_txs -eth_tx -ExecuteBlock -PublishProofBlocksOnchain -CommitBlocks -entrypoint -gas_limit -TxSender -UX -BasicWitnessInputProducer -eth_tx_history -PENDING_BLOCK -from_block -namespace -PriorityQueue -Görli -Ropsten -Rinkeby -tokio -threadpool -IntrinsicGas -InsufficientFundsForTransfer -ChainId -hyperchains -eth_getLogs -façade -virtual_blocks_per_miniblock -virtual_block_interval -max_overhead -total_gas_limit -cloneable -timestamped -healthcheck -Healthcheck -HealthCheck -readonly -upgrader -startup -BFT -PingCAP -witgen -ok -hacky -ceil -Infura -synth -proto - -AUTOGENERATED -x19Ethereum -block_timestamp -SYSTEM_BLOCK_INFO_BLOCK_NUMBER_MULTIPLIER -MAX_L2_TX_GAS_LIMIT -MAX_TX_ERGS_LIMIT -OneTxTracer -multicall -Multicall's -Multicall3 -proxied -scalers -updatable -instantiation -unexecuted -transactional -benchmarking -virtual_blocks_interval -dal -codebase -compactions -M6 -compiler_common -noop -tokenized -rustc -sqlx -zkevm -Boojum -Sepolia -psql -Cuda -cuda -hdcaa -impls -abda -edaf -unsynchronized -CUDA -gcloud -NVME -OTLP -multiVM -Deduplicator -lobkc -sread -myfunction -merklelization -beaf -subcalls -unallowed -Nuxt -Merklized -satisfiability -demultiplex -precompile -statekeeper -matchers -lifecycle -dedup -deduped -crаsh -protobuf -L1Tx -EIP -DecommittmentProcessor -decommitment -tokenized -Aggregator -DecommittmentProcessor -decommitment -hardcoded -plookup -shivini -EIP4844 -KZG -secp256k1 -vendoring -publickey -keypair -Electrum -healthcheck -healthchecks -after_node_shutdown -runnable -downcasting -parameterized -reimplementation -composability -md5 -shivini -balancer -lookups -stateful -getPubdataPricingMode -Uint -implementors -WIP -oneshot -p2p -StorageProcessor -StorageMarker -SIGINT -opentelemetry -PubdataSendingMode -FriGpuProverArchiver -vm -demuxer -2k -4k -superset -80M -780kb -None -Nones -evm_simulator_code_hash -pubdata_costs -storage_refunds -state_keeper's -witness_generator -arity -recursion_tip -RECURSION_TIP_ARITY -empty_proof -hyperchain -storages -vec -zksync_merkle_tree -TreeMetadata -delegator -decrement -whitelisted -Bbellman -Sbellman -DCMAKE -preloaded -e2e -upcasting -foundryup -uncached -untrimmed -UNNEST -semver -TeeRequestProcessor -l1_batch_number -RequestProcessorError -map_err -proof_inputs -submit_proofs -ready_to_be_proven -privkey diff --git a/checks-config/links.json b/checks-config/links.json deleted file mode 100644 index b18b9608f16f..000000000000 --- a/checks-config/links.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "ignorePatterns": [ - { - "pattern": "^https://github\\.com/matter-labs/zksync-2-dev/" - }, - { - "pattern": "^https://www\\.notion\\.so/" - }, - { - "pattern": "^https://github\\.com/matter-labs/zksync-era/compare/" - }, - { - "pattern": "^https://twitter\\.com/zksync" - }, - { - "pattern": "^https://twitter\\.com/zkSyncDevs" - }, - { - "pattern": "^https://github\\.com/matter-labs/zk_evm" - }, - { - "pattern": "^https://sepolia\\.etherscan\\.io/tx/0x18c2a113d18c53237a4056403047ff9fafbf772cb83ccd44bb5b607f8108a64c" - }, - { - "pattern": "^https://github\\.com/matter-labs/zksync-era/commit/" - }, - { - "pattern": "^https://github\\.com/matter-labs//era-compiler-llvm" - } - ], - "aliveStatusCodes": [0, 200, 206, 304] -} diff --git a/docker/zk-environment/Dockerfile b/docker/zk-environment/Dockerfile index 9c9393ed5188..c5cb35cf1a07 100644 --- a/docker/zk-environment/Dockerfile +++ b/docker/zk-environment/Dockerfile @@ -84,7 +84,7 @@ RUN mkdir -p /etc/apt/keyrings && \ wget -c -O - https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \ apt-get update && apt-get install nodejs -y && \ - npm install -g yarn && npm install -g cspell + npm install -g yarn # Install Rust and required cargo packages ENV RUSTUP_HOME=/usr/local/rustup \ @@ -105,7 +105,6 @@ RUN wget -c -O - https://sh.rustup.rs | bash -s -- -y && \ RUN cargo install --version=0.7.3 sqlx-cli RUN cargo install cargo-nextest -RUN cargo install cargo-spellcheck # Copy compiler (both solc and zksolc) binaries # Obtain `solc` 0.8.20. diff --git a/docs/guides/development.md b/docs/guides/development.md index 5e53877993dd..c859017848b5 100644 --- a/docs/guides/development.md +++ b/docs/guides/development.md @@ -89,56 +89,6 @@ Currently the following criteria are checked: - Other code should always be formatted via `zk fmt`. - Dummy Prover should not be staged for commit (see below for the explanation). -## Spell Checking - -In our development workflow, we utilize a spell checking process to ensure the quality and accuracy of our documentation -and code comments. This is achieved using two primary tools: `cspell` and `cargo-spellcheck`. This section outlines how -to use these tools and configure them for your needs. - -### Using the Spellcheck Command - -The spell check command `zk spellcheck` is designed to check for spelling errors in our documentation and code. To run -the spell check, use the following command: - -``` -zk spellcheck -Options: ---pattern : Specifies the glob pattern for files to check. Default is docs/**/*. ---use-cargo: Utilize cargo spellcheck. ---use-cspell: Utilize cspell. -``` - -### General Rules - -**Code References in Comments**: When referring to code elements within development comments, they should be wrapped in -backticks. For example, reference a variable as `block_number`. - -**Code Blocks in Comments**: For larger blocks of pseudocode or commented-out code, use code blocks formatted as -follows: - -```` -// ``` -// let overhead_for_pubdata = { -// let numerator: U256 = overhead_for_block_gas * total_gas_limit -// + gas_per_pubdata_byte_limit * U256::from(MAX_PUBDATA_PER_BLOCK); -// let denominator = -// gas_per_pubdata_byte_limit * U256::from(MAX_PUBDATA_PER_BLOCK) + overhead_for_block_gas; -// ``` -```` - -**Language Settings**: We use the Hunspell language setting of `en_US`. - -**CSpell Usage**: For spell checking within the `docs/` directory, we use `cspell`. The configuration for this tool is -found in `cspell.json`. It's tailored to check our documentation for spelling errors. - -**Cargo-Spellcheck for Rust and Dev Comments**: For Rust code and development comments, `cargo-spellcheck` is used. Its -configuration is maintained in `era.cfg`. - -### Adding Words to the Dictionary - -To add a new word to the spell checker dictionary, navigate to `/spellcheck/era.dic` and include the word. Ensure that -the word is relevant and necessary to be included in the dictionary to maintain the integrity of our documentation. - ## Using Dummy Prover By default, the chosen prover is a "dummy" one, meaning that it doesn't actually compute proofs but rather uses mocks to diff --git a/infrastructure/zk/package.json b/infrastructure/zk/package.json index dc6aded093a2..29d47184fa09 100644 --- a/infrastructure/zk/package.json +++ b/infrastructure/zk/package.json @@ -31,7 +31,6 @@ "@types/tabtab": "^3.0.1", "hardhat": "=2.22.2", "typescript": "^4.3.5", - "cspell": "^8.3.2", "sql-formatter": "^13.1.0" } } diff --git a/infrastructure/zk/src/index.ts b/infrastructure/zk/src/index.ts index 0c11c110c6e3..5aef41cca388 100644 --- a/infrastructure/zk/src/index.ts +++ b/infrastructure/zk/src/index.ts @@ -23,7 +23,6 @@ import { command as db } from './database'; import { command as verifyUpgrade } from './verify-upgrade'; import { proverCommand } from './prover_setup'; import { command as status } from './status'; -import { command as spellcheck } from './spellcheck'; import { command as setupEn } from './setup_en'; import * as env from './env'; @@ -50,7 +49,6 @@ const COMMANDS = [ proverCommand, env.command, status, - spellcheck, setupEn, completion(program as Command) ]; diff --git a/infrastructure/zk/src/spellcheck.ts b/infrastructure/zk/src/spellcheck.ts deleted file mode 100644 index 8bf78869788d..000000000000 --- a/infrastructure/zk/src/spellcheck.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Command } from 'commander'; -import * as utils from 'utils'; - -export async function runSpellCheck(pattern: string, useCargo: boolean, useCSpell: boolean) { - // Default commands for cSpell and cargo spellcheck - const cSpellCommand = `cspell "${pattern}" --config=./checks-config/cspell.json`; - const cargoCommand = `cargo spellcheck --cfg=./checks-config/era.cfg --code 1`; - // Necessary to run cargo spellcheck in the prover directory explicitly as - // it is not included in the root cargo.toml file - const cargoCommandForProver = `cargo spellcheck --cfg=../checks-config/era.cfg --code 1`; - - try { - let results = []; - - // Run cspell over all **/*.md files - if (useCSpell || (!useCargo && !useCSpell)) { - results.push(await utils.spawn(cSpellCommand)); - } - - // Run cargo spellcheck in core and prover directories - if (useCargo || (!useCargo && !useCSpell)) { - results.push(await utils.spawn(cargoCommand)); - results.push(await utils.spawn('cd prover && ' + cargoCommandForProver)); - } - - // Check results and exit with error code if any command failed - if (results.some((code) => code !== 0)) { - console.error('Spell check failed'); - process.exit(1); - } - } catch (error) { - console.error('Error occurred during spell checking:', error); - process.exit(1); - } -} - -export const command = new Command('spellcheck') - .option('--pattern ', 'Glob pattern for files to check', '**/*.md') - .option('--use-cargo', 'Use cargo spellcheck') - .option('--use-cspell', 'Use cspell') - .description('Run spell check on specified files') - .action((cmd) => { - runSpellCheck(cmd.pattern, cmd.useCargo, cmd.useCSpell); - });