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

feat(format): rules for hasMacroNameInMend

This commit is contained in:
Saad Jutt
2021-04-21 16:25:36 +05:00
parent 59f7e71919
commit db2dbb1c69
3 changed files with 137 additions and 33 deletions

View File

@@ -8,6 +8,8 @@ interface Macro {
endLineNumber: number | null
declaration: string
termination: string
declarationTrimmedStatement: string
terminationTrimmedStatement: string
parentMacro: string
hasMacroNameInMend: boolean
hasParentheses: boolean
@@ -53,7 +55,9 @@ export const parseMacros = (text: string, config?: LintConfig): Macro[] => {
hasMacroNameInMend: false,
mismatchedMendMacroName: '',
declaration: line,
termination: ''
termination: '',
declarationTrimmedStatement: trimmedStatement,
terminationTrimmedStatement: ''
})
} else if (trimmedStatement.startsWith('%mend')) {
if (macroStack.length) {
@@ -66,6 +70,7 @@ export const parseMacros = (text: string, config?: LintConfig): Macro[] => {
? ''
: mendMacroName
macro.termination = line
macro.terminationTrimmedStatement = trimmedStatement
macros.push(macro)
} else {
macros.push({
@@ -77,7 +82,9 @@ export const parseMacros = (text: string, config?: LintConfig): Macro[] => {
hasMacroNameInMend: false,
mismatchedMendMacroName: '',
declaration: '',
termination: line
termination: line,
declarationTrimmedStatement: '',
terminationTrimmedStatement: trimmedStatement
})
}
}