Merge pull request #74 from Instadapp/cl-args-to-set-check-path

cl args to set check path
This commit is contained in:
Thrilok kumar 2021-09-08 00:24:31 +05:30 committed by GitHub
commit 417bf6795a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 6 deletions

View File

@ -53,4 +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).

View File

@ -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"
},

View File

@ -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

7
status-checks/readme.md Normal file
View File

@ -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`