mirror of
https://github.com/sasjs/lint.git
synced 2025-12-10 17:34:36 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12bfcd69bd | ||
|
|
6350d32d0c | ||
|
|
1c09a10290 |
@@ -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 [
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@ export async function getLintConfig(): Promise<LintConfig> {
|
||||
const configuration = await readFile(
|
||||
path.join(projectRoot, '.sasjslint')
|
||||
).catch((_) => {
|
||||
console.warn('Unable to load .sasjslint file. Using default configuration.')
|
||||
return JSON.stringify(DefaultLintConfiguration)
|
||||
})
|
||||
return new LintConfig(JSON.parse(configuration))
|
||||
|
||||
Reference in New Issue
Block a user