mirror of
https://github.com/sasjs/lint.git
synced 2025-12-10 17:34:36 +00:00
Merge pull request #15 from sasjs/doxygen-header-false-negative
fix(has-doxygen-header): fix logic to handle files with comment blocks
This commit is contained in:
@@ -34,6 +34,27 @@ describe('hasDoxygenHeader', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('should return an array with a single diagnostic when the file has comment blocks but no header', () => {
|
||||
const content = `
|
||||
%macro mf_getuniquelibref(prefix=mclib,maxtries=1000);
|
||||
%local x libref;
|
||||
%let x={SAS002};
|
||||
/** Comment Line 1
|
||||
* Comment Line 2
|
||||
*/
|
||||
%do x=0 %to &maxtries;`
|
||||
|
||||
expect(hasDoxygenHeader.test(content)).toEqual([
|
||||
{
|
||||
message: 'File missing Doxygen header',
|
||||
lineNumber: 1,
|
||||
startColumnNumber: 1,
|
||||
endColumnNumber: 1,
|
||||
severity: Severity.Warning
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('should return an array with a single diagnostic when the file is undefined', () => {
|
||||
const content = undefined
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const description =
|
||||
const message = 'File missing Doxygen header'
|
||||
const test = (value: string) => {
|
||||
try {
|
||||
const hasFileHeader = value.split('/**')[0] !== value
|
||||
const hasFileHeader = value.trimStart().startsWith('/*')
|
||||
if (hasFileHeader) return []
|
||||
return [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user