mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
checks dev and title
This commit is contained in:
parent
6715717ca8
commit
a0519d701f
|
@ -278,6 +278,28 @@ const checkName = async (connector) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const checkHeadComments = async (connector) => {
|
||||||
|
try {
|
||||||
|
const errors = []
|
||||||
|
const strs = connector.code.split('\n')
|
||||||
|
let haveTitle = false
|
||||||
|
let haveDev = false
|
||||||
|
for (let index = 0; index < strs.length; index++) {
|
||||||
|
if (!strs[index].includes('{')) {
|
||||||
|
if (strs[index].includes('@title')) haveTitle = true
|
||||||
|
if (strs[index].includes('@dev')) haveDev = true
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!haveTitle) errors.push(`@title missing in ${connector.path}/main.sol`)
|
||||||
|
if (!haveDev) errors.push(`@dev missing in ${connector.path}/main.sol`)
|
||||||
|
return errors
|
||||||
|
} catch (error) {
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function checkMain () {
|
async function checkMain () {
|
||||||
try {
|
try {
|
||||||
const errors = []
|
const errors = []
|
||||||
|
@ -290,11 +312,13 @@ async function checkMain () {
|
||||||
const { eventsErrors, eventsWarnings } = await checkEvents(connectors[index])
|
const { eventsErrors, eventsWarnings } = await checkEvents(connectors[index])
|
||||||
const commentsErrors = await checkComments(connectors[index])
|
const commentsErrors = await checkComments(connectors[index])
|
||||||
const nameErrors = await checkName(connectors[index])
|
const nameErrors = await checkName(connectors[index])
|
||||||
|
const headCommentsErrors = await checkHeadComments(connectors[index])
|
||||||
|
|
||||||
errors.push(...forbiddenErrors)
|
errors.push(...forbiddenErrors)
|
||||||
errors.push(...eventsErrors)
|
errors.push(...eventsErrors)
|
||||||
errors.push(...commentsErrors)
|
errors.push(...commentsErrors)
|
||||||
errors.push(...nameErrors)
|
errors.push(...nameErrors)
|
||||||
|
errors.push(...headCommentsErrors)
|
||||||
warnings.push(...eventsWarnings)
|
warnings.push(...eventsWarnings)
|
||||||
}
|
}
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user