1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-19 10:10:05 +00:00

test: for hasMacroParentheses & noNestedMacros

This commit is contained in:
Saad Jutt
2021-04-07 00:58:38 +05:00
parent 3530badf49
commit 1808d9851a
5 changed files with 221 additions and 6 deletions

View File

@@ -22,14 +22,23 @@ const test = (value: string) => {
commentStarted
))
if (trimmedStatement.startsWith('%macro ')) {
if (trimmedStatement.startsWith('%macro')) {
const macroNameDefinition = trimmedStatement
.slice(7, trimmedStatement.length)
.trim()
const macroNameDefinitionParts = macroNameDefinition.split('(')
const macroName = macroNameDefinitionParts[0]
if (macroNameDefinitionParts.length === 1)
if (!macroName)
diagnostics.push({
message: 'Macro definition missing name',
lineNumber: getLineNumber(statements, index + 1),
startColumnNumber: getColNumber(statement, '%macro'),
endColumnNumber: statement.length,
severity: Severity.Warning
})
else if (macroNameDefinitionParts.length === 1)
diagnostics.push({
message,
lineNumber: getLineNumber(statements, index + 1),