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

chore(*): rename macro properties

This commit is contained in:
Krishna Acondy
2021-04-21 15:10:28 +01:00
parent 060b838f21
commit abc2f75dc0
4 changed files with 38 additions and 40 deletions

View File

@@ -12,10 +12,10 @@ describe('parseMacros', () => {
expect(macros.length).toEqual(1)
expect(macros).toContainEqual({
name: 'test',
declaration: '%macro test;',
declarationLine: '%macro test;',
terminationLine: '%mend',
declaration: '%macro test',
termination: '%mend',
declarationTrimmedStatement: '%macro test',
terminationTrimmedStatement: '%mend',
startLineNumber: 1,
endLineNumber: 3,
parentMacro: '',
@@ -38,10 +38,10 @@ describe('parseMacros', () => {
expect(macros.length).toEqual(2)
expect(macros).toContainEqual({
name: 'foo',
declaration: '%macro foo;',
termination: '%mend;',
declarationTrimmedStatement: '%macro foo',
terminationTrimmedStatement: '%mend',
declarationLine: '%macro foo;',
terminationLine: '%mend;',
declaration: '%macro foo',
termination: '%mend',
startLineNumber: 1,
endLineNumber: 3,
parentMacro: '',
@@ -51,10 +51,10 @@ describe('parseMacros', () => {
})
expect(macros).toContainEqual({
name: 'bar',
declaration: '%macro bar();',
termination: '%mend bar;',
declarationTrimmedStatement: '%macro bar()',
terminationTrimmedStatement: '%mend bar',
declarationLine: '%macro bar();',
terminationLine: '%mend bar;',
declaration: '%macro bar()',
termination: '%mend bar',
startLineNumber: 4,
endLineNumber: 6,
parentMacro: '',
@@ -77,10 +77,10 @@ describe('parseMacros', () => {
expect(macros.length).toEqual(2)
expect(macros).toContainEqual({
name: 'test',
declarationLine: '%macro test()',
terminationLine: '%mend test',
declaration: '%macro test()',
termination: '%mend test',
declarationTrimmedStatement: '%macro test()',
terminationTrimmedStatement: '%mend test',
startLineNumber: 1,
endLineNumber: 6,
parentMacro: '',
@@ -90,10 +90,10 @@ describe('parseMacros', () => {
})
expect(macros).toContainEqual({
name: 'test2',
declaration: ' %macro test2',
termination: ' %mend',
declarationTrimmedStatement: '%macro test2',
terminationTrimmedStatement: '%mend',
declarationLine: ' %macro test2',
terminationLine: ' %mend',
declaration: '%macro test2',
termination: '%mend',
startLineNumber: 3,
endLineNumber: 5,
parentMacro: 'test',

View File

@@ -6,10 +6,10 @@ interface Macro {
name: string
startLineNumber: number | null
endLineNumber: number | null
declarationLine: string
terminationLine: string
declaration: string
termination: string
declarationTrimmedStatement: string
terminationTrimmedStatement: string
parentMacro: string
hasMacroNameInMend: boolean
hasParentheses: boolean
@@ -54,10 +54,10 @@ export const parseMacros = (text: string, config?: LintConfig): Macro[] => {
hasParentheses: trimmedStatement.endsWith('()'),
hasMacroNameInMend: false,
mismatchedMendMacroName: '',
declaration: line,
termination: '',
declarationTrimmedStatement: trimmedStatement,
terminationTrimmedStatement: ''
declarationLine: line,
terminationLine: '',
declaration: trimmedStatement,
termination: ''
})
} else if (trimmedStatement.startsWith('%mend')) {
if (macroStack.length) {
@@ -69,8 +69,8 @@ export const parseMacros = (text: string, config?: LintConfig): Macro[] => {
macro.mismatchedMendMacroName = macro.hasMacroNameInMend
? ''
: mendMacroName
macro.termination = line
macro.terminationTrimmedStatement = trimmedStatement
macro.terminationLine = line
macro.termination = trimmedStatement
macros.push(macro)
} else {
macros.push({
@@ -81,10 +81,10 @@ export const parseMacros = (text: string, config?: LintConfig): Macro[] => {
hasParentheses: false,
hasMacroNameInMend: false,
mismatchedMendMacroName: '',
declarationLine: '',
terminationLine: line,
declaration: '',
termination: line,
declarationTrimmedStatement: '',
terminationTrimmedStatement: trimmedStatement
termination: trimmedStatement
})
}
}