diff --git a/.husky/_/dissalowed_words.sh b/.husky/_/dissalowed_words.sh new file mode 100755 index 000000000..00162ccfa --- /dev/null +++ b/.husky/_/dissalowed_words.sh @@ -0,0 +1,17 @@ +#!/bin/bash +COLOR_REST="$(tput sgr0)" +COLOR_MAGENTA="$(tput setaf 5)" +COLOR_RED="$(tput setaf 1)" +COLOR_YELLOW="$(tput setaf 3)" +status=0 + +for file in $(git diff --name-only --diff-filter=ACMT); +do + if [ "${file: -3}" != ".ts" ] && [ "${file: -3}" != ".js" ]; then continue; fi + for line in $(grep -in -E "\.only\(" "$file" | cut -f1 -d:); + do + printf "%40s\n" "${COLOR_RED}ERROR:${COLOR_REST} Disallowed expression${COLOR_YELLOW} .only()${COLOR_REST} in file: $COLOR_MAGENTA${line}:${file}$COLOR_REST" + status=1 + done +done +exit $status diff --git a/.husky/pre-commit b/.husky/pre-commit index f23377e95..b15fa986d 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,5 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" +. "$(dirname "$0")/_/dissalowed_words.sh" yarn run lint-staged diff --git a/CHANGELOG.md b/CHANGELOG.md index 362884512..4c97c59f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ from `algosdk` and sends it to the network. - Added support for new txn opcode fileds `ApprovalProgramPages`, `ClearProgramStatePages`, `NumApprovalProgramPages`, `NumClearProgramStatePages`. - Added additional checks for the `maxStackByteElementSize` and `maxProgramLength` in `Runtime`. - Added partial support for `bn254` opcodes. The full support delyed until the official release of `TEALv8/v9`. +- Added a new pre-commit hook to check if there are any `.only`in tests . If there are any it will display error in which files/lines the problem was found. #### @algo-builder/web - Added support for logic signature to `executeTx` method of `Webmode` for AlgoSigner, MyAlgo Wallet and Wallet Connect. diff --git a/packages/runtime/test/src/interpreter/inner-transaction.ts b/packages/runtime/test/src/interpreter/inner-transaction.ts index c8832bfec..a9e3eb367 100644 --- a/packages/runtime/test/src/interpreter/inner-transaction.ts +++ b/packages/runtime/test/src/interpreter/inner-transaction.ts @@ -1,5 +1,6 @@ import { decodeAddress, encodeAddress, getApplicationAddress } from "algosdk"; import { assert } from "chai"; + import { bobAcc } from "../../../../algob/test/mocks/account"; import { AccountStore } from "../../../src/account"; import { RUNTIME_ERRORS } from "../../../src/errors/errors-list"; @@ -1477,6 +1478,5 @@ describe("Inner Transactions", function () { assert.equal(receiver, foreignAppAccAddr); }); }); - }); });