Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git hook #822

Merged
merged 51 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
615c8df
add pre-commit check for dissalowed words
sczembor Oct 24, 2022
6499218
change regular exp
sczembor Oct 24, 2022
ad32449
change regular exp
sczembor Oct 24, 2022
0732107
change regular exp
sczembor Oct 24, 2022
0a9838f
test
sczembor Oct 24, 2022
59a82e0
test
sczembor Oct 24, 2022
6dda558
test
sczembor Oct 24, 2022
4391b9d
updated script
sczembor Oct 24, 2022
2de01e8
test should fail
sczembor Oct 24, 2022
f6a21bd
updated script
sczembor Oct 24, 2022
3007549
test
sczembor Oct 24, 2022
6bd8a28
test
sczembor Oct 24, 2022
4942e8d
test
sczembor Oct 24, 2022
ae46dc0
test
sczembor Oct 24, 2022
0e84710
test
sczembor Oct 24, 2022
9bfe633
test
sczembor Oct 24, 2022
7fa00cd
test
sczembor Oct 24, 2022
66fb5f3
test
sczembor Oct 24, 2022
c10b9a5
test
sczembor Oct 24, 2022
5018bb3
test
sczembor Oct 24, 2022
520373b
test
sczembor Oct 24, 2022
a69d617
test
sczembor Oct 24, 2022
30be61d
test
sczembor Oct 24, 2022
f7fbb91
test
sczembor Oct 24, 2022
02bd4d0
test
sczembor Oct 24, 2022
c3c48fe
test
sczembor Oct 24, 2022
49ccedc
test
sczembor Oct 24, 2022
c39d07d
test
sczembor Oct 24, 2022
9d1ecb7
test
sczembor Oct 24, 2022
2d75424
test
sczembor Oct 24, 2022
693faac
test
sczembor Oct 24, 2022
c792519
updated script to display several files at once and only check .ts an…
sczembor Oct 24, 2022
0ad2e6b
showcase
sczembor Oct 24, 2022
2333c02
showcase
sczembor Oct 24, 2022
5c4cb02
change the bash
sczembor Oct 24, 2022
de5c934
update change log
sczembor Oct 24, 2022
ed6d274
Update packages/runtime/test/src/interpreter/inner-transaction.ts
sczembor Oct 24, 2022
b0fc1fa
Apply suggestions from code review
sczembor Oct 24, 2022
ca5611c
cleanup
sczembor Oct 24, 2022
3a75b5a
example
sczembor Oct 24, 2022
2f644f4
example
sczembor Oct 24, 2022
7b14875
example
sczembor Oct 24, 2022
0af2a6b
Update .husky/_/dissalowed_words.sh
sczembor Oct 24, 2022
965c223
test
sczembor Oct 25, 2022
d03870d
test
sczembor Oct 25, 2022
b44fe3e
add line number to error output
sczembor Oct 25, 2022
8a2af30
Merge branch 'git_hook' of https://github.com/scale-it/algo-builder i…
sczembor Oct 25, 2022
0c12192
delete cached varaible from grep
sczembor Oct 25, 2022
141e7c3
Apply suggestions from code review
sczembor Oct 25, 2022
4e21234
Update CHANGELOG.md
sczembor Oct 25, 2022
d554b6e
add empty line at the end of the script
sczembor Oct 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .husky/_/dissalowed_words.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
COLOR_REST="$(tput sgr0)"
COLOR_MAGENTA="$(tput setaf 4)"
COLOR_RED="$(tput setaf 1)"
COLOR_YELLOW="$(tput setaf 3)"
status=0
set +o posix
while read x file; do
if [ "$x" == 'D' ]; then continue; fi
if ! [[ "${file: -3}" == ".ts" ]] || [[ "${file: -3}" == ".js" ]]; then continue; fi
if grep -E -q "\.only\(" "$file" ; then
printf "%40s\n" "${COLOR_RED}ERROR:${COLOR_REST} Disallowed expression${COLOR_YELLOW} .only()${COLOR_REST} in file: $COLOR_MAGENTA${file}$COLOR_REST"
status=1
fi
done < <(git diff --cached --name-status);
exit $status
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# . "$(dirname "$0")/_/dissalowed_words.sh"

yarn run lint-staged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 the problem was found.

#### @algo-builder/web
- Added support for logic signature to `executeTx` method of `Webmode` for AlgoSigner, MyAlgo Wallet and Wallet Connect.
Expand Down
16 changes: 6 additions & 10 deletions packages/runtime/test/src/interpreter/inner-transaction.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
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";
import { getProgram, Runtime } from "../../../src/index";
import { Interpreter } from "../../../src/interpreter/interpreter";
import { ALGORAND_ACCOUNT_MIN_BALANCE } from "../../../src/lib/constants";
import {
AccountAddress,
AccountStoreI,
ExecutionMode,
TxOnComplete,
} from "../../../src/types";
import { AccountAddress, AccountStoreI, ExecutionMode, TxOnComplete } from "../../../src/types";
import { useFixture } from "../../helpers/integration";
import { expectRuntimeError } from "../../helpers/runtime-errors";
import { elonMuskAccount, johnAccount } from "../../mocks/account";
Expand Down Expand Up @@ -240,7 +236,9 @@ describe("Inner Transactions", function () {

it(`should fail: "insufficient balance" because app account is charged fee`, function () {
// set application account balance to 0
const appAcc = interpreter.runtime.ctx.state.accounts.get(applicationAccount.account.addr);
const appAcc = interpreter.runtime.ctx.state.accounts.get(
applicationAccount.account.addr
);
if (appAcc) {
appAcc.amount = BigInt(0);
}
Expand Down Expand Up @@ -1255,7 +1253,7 @@ describe("Inner Transactions", function () {
});
});

describe("Teal v6 update", function () {
describe.only("Teal v6 update", function () {
this.beforeEach(function () {
setUpInterpreter(6, ALGORAND_ACCOUNT_MIN_BALANCE);
});
Expand All @@ -1266,7 +1264,6 @@ describe("Inner Transactions", function () {
// init more balance for application to test inner transaction
setUpInterpreter(6, ALGORAND_ACCOUNT_MIN_BALANCE * 10);
});

it("Should support keyreg transaction", function () {
program = `
itxn_begin
Expand Down Expand Up @@ -1477,6 +1474,5 @@ describe("Inner Transactions", function () {
assert.equal(receiver, foreignAppAccAddr);
});
});

});
});