mirror of
https://github.com/sasjs/lint.git
synced 2026-01-13 07:10:05 +00:00
feat(lint): implement v1 with 3 rules - trailing spaces, encoded passwords and Doxygen header
This commit is contained in:
24
src/rules/hasDoxygenHeader.ts
Normal file
24
src/rules/hasDoxygenHeader.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { FileLintRule } from '../types/LintRule'
|
||||
import { LintRuleType } from '../types/LintRuleType'
|
||||
|
||||
const name = 'hasDoxygenHeader'
|
||||
const description =
|
||||
'Enforce the presence of a Doxygen header at the start of each file.'
|
||||
const warning = 'File missing Doxygen header'
|
||||
const test = (value: string) => {
|
||||
try {
|
||||
const hasFileHeader = value.split('/**')[0] !== value
|
||||
if (hasFileHeader) return []
|
||||
return [{ warning, lineNumber: 1, columnNumber: 1 }]
|
||||
} catch (e) {
|
||||
return [{ warning, lineNumber: 1, columnNumber: 1 }]
|
||||
}
|
||||
}
|
||||
|
||||
export const hasDoxygenHeader: FileLintRule = {
|
||||
type: LintRuleType.File,
|
||||
name,
|
||||
description,
|
||||
warning,
|
||||
test
|
||||
}
|
||||
Reference in New Issue
Block a user