Skip to content

Commit

Permalink
fix(has-doxygen-header): fix logic to handle files with comment blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
krishna-acondy committed Mar 30, 2021
1 parent 1c09a10 commit 6350d32
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/rules/hasDoxygenHeader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/rules/hasDoxygenHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
{
Expand Down

0 comments on commit 6350d32

Please sign in to comment.