From 6c5460fac2745e722438330124f9c8010a2adb3c Mon Sep 17 00:00:00 2001 From: Aleksandr S Date: Sun, 5 Sep 2021 11:32:18 +0300 Subject: [PATCH 1/2] cl args to set check path --- README.md | 6 ++++++ package.json | 1 + status-checks/check.js | 13 ++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e9a60cd8..39b78357 100644 --- a/README.md +++ b/README.md @@ -54,3 +54,9 @@ Few things to consider while writing the connector: If you can't find something you're looking for or have any questions, ask them at our developers community on [Discord](https://discord.gg/83vvrnY) or simply send an [Email](mailto:info@instadapp.io). +## Check run + +use +`npm run check` +to check `connectors` directory. Use `connector=$` argument to check specific connector: +`npm run check connector=contracts/mainnet/common` diff --git a/package.json b/package.json index 589d093e..22fdaec2 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "test": "hardhat test", "coverage": "./node_modules/.bin/solidity-coverage", + "check": "node status-checks/huskyCheck.js", "check-husky": "node status-checks/huskyCheck.js", "build-contracts": "sol-merger \"./contracts/connectors/mock.sol\" ./contracts/build" }, diff --git a/status-checks/check.js b/status-checks/check.js index a76d81ae..c0848d77 100644 --- a/status-checks/check.js +++ b/status-checks/check.js @@ -3,13 +3,11 @@ const path = require('path') const forbiddenStrings = ['selfdestruct'] -const getConnectorsList = async () => { +const getConnectorsList = async (connectorsRootsDirs) => { try { const connectors = [] - const connectorsRootsDirs = ['mainnet', 'polygon'] for (let index = 0; index < connectorsRootsDirs.length; index++) { - const root = `contracts/${connectorsRootsDirs[index]}/connectors` - const dirs = [root] + const dirs = [connectorsRootsDirs[index]] while (dirs.length) { const currentDir = dirs.pop() const subs = fs.readdirSync(currentDir, { withFileTypes: true }) @@ -326,9 +324,14 @@ const checkHeadComments = async (connector) => { async function checkMain () { try { + const connectorsRootsDirsDefault = ['mainnet', 'polygon'].map(v=> `contracts/${v}/connectors`) + const customPathArg = process.argv.find(a => a.startsWith('connector=')) + const connectorsRootsDirs = customPathArg + ? [customPathArg.slice(10)] + : connectorsRootsDirsDefault const errors = [] const warnings = [] - const connectors = await getConnectorsList() + const connectors = await getConnectorsList(connectorsRootsDirs) for (let index = 0; index < connectors.length; index++) { const { forbiddenErrors, code } = await checkForbidden(connectors[index].path) connectors[index].code = code From 7b2dd953b1575ff885773e2a79883edc1c4f0b01 Mon Sep 17 00:00:00 2001 From: Aleksandr S Date: Sun, 5 Sep 2021 19:53:23 +0300 Subject: [PATCH 2/2] readme update --- README.md | 7 ------- status-checks/readme.md | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 status-checks/readme.md diff --git a/README.md b/README.md index 39b78357..be1b4893 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,3 @@ Few things to consider while writing the connector: ### Support If you can't find something you're looking for or have any questions, ask them at our developers community on [Discord](https://discord.gg/83vvrnY) or simply send an [Email](mailto:info@instadapp.io). - -## Check run - -use -`npm run check` -to check `connectors` directory. Use `connector=$` argument to check specific connector: -`npm run check connector=contracts/mainnet/common` diff --git a/status-checks/readme.md b/status-checks/readme.md new file mode 100644 index 00000000..ed376c25 --- /dev/null +++ b/status-checks/readme.md @@ -0,0 +1,7 @@ + +# Check run + +use +`npm run check` +to check `connectors` directory. Use `connector=$` argument to check specific connector: +`npm run check connector=contracts/mainnet/common`