Skip to content

Commit

Permalink
Merge pull request #15 from sasjs/doxygen-header-false-negative
Browse files Browse the repository at this point in the history
fix(has-doxygen-header): fix logic to handle files with comment blocks
  • Loading branch information
allanbowe authored Mar 30, 2021
2 parents 1c09a10 + 6350d32 commit 12bfcd6
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 12bfcd6

Please sign in to comment.