From a0519d701f20ddaa48bc81fe5bf7ef514d711b0f Mon Sep 17 00:00:00 2001 From: Aleksandr S Date: Tue, 11 May 2021 19:47:05 +0300 Subject: [PATCH] checks dev and title --- status-checks/check.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/status-checks/check.js b/status-checks/check.js index 28698d61..8c9addbe 100644 --- a/status-checks/check.js +++ b/status-checks/check.js @@ -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 () { try { const errors = [] @@ -290,11 +312,13 @@ async function checkMain () { const { eventsErrors, eventsWarnings } = await checkEvents(connectors[index]) const commentsErrors = await checkComments(connectors[index]) const nameErrors = await checkName(connectors[index]) + const headCommentsErrors = await checkHeadComments(connectors[index]) errors.push(...forbiddenErrors) errors.push(...eventsErrors) errors.push(...commentsErrors) errors.push(...nameErrors) + errors.push(...headCommentsErrors) warnings.push(...eventsWarnings) } if (errors.length) {