1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-10 17:34:36 +00:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Allan Bowe
12bfcd69bd Merge pull request #15 from sasjs/doxygen-header-false-negative
fix(has-doxygen-header): fix logic to handle files with comment blocks
2021-03-30 09:29:23 +01:00
Krishna Acondy
6350d32d0c fix(has-doxygen-header): fix logic to handle files with comment blocks 2021-03-30 09:24:03 +01:00
Krishna Acondy
1c09a10290 fix(*): remove warning when using default config 2021-03-30 08:42:52 +01:00
3 changed files with 22 additions and 2 deletions

View File

@@ -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

View File

@@ -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 [
{

View File

@@ -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))