mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
cl args to set check path
This commit is contained in:
parent
cf504594be
commit
6c5460fac2
|
@ -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`
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user