(model: Entry, options: {
readonly enforceVersion: boolean
})
| 26 | } |
| 27 | |
| 28 | function checkEntry(model: Entry, options: { |
| 29 | readonly enforceVersion: boolean |
| 30 | }) { |
| 31 | return Effect.gen(function*() { |
| 32 | const source = yield* Parser.Source |
| 33 | const config = yield* Configuration.Configuration |
| 34 | |
| 35 | let errors: Array<string> = [] |
| 36 | |
| 37 | // description |
| 38 | if (config.enforceDescriptions) { |
| 39 | if (model.doc.description === undefined) { |
| 40 | errors = errors.concat(makeError( |
| 41 | source, |
| 42 | model.position, |
| 43 | (filePath, frame) => `Missing description in file ${filePath}:\n\n${frame}` |
| 44 | )) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | // @example tags |
| 49 | if (config.enforceExamples) { |
| 50 | if (model.doc.examples.length === 0) { |
| 51 | errors = errors.concat(makeError( |
| 52 | source, |
| 53 | model.position, |
| 54 | (filePath, frame) => `Missing examples in file ${filePath}:\n\n${frame}` |
| 55 | )) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // @since tags |
| 60 | if (config.enforceVersion && options.enforceVersion !== false) { |
| 61 | const since = model.doc.since |
| 62 | if (since.length === 0) { |
| 63 | errors = errors.concat(makeError( |
| 64 | source, |
| 65 | model.position, |
| 66 | (filePath, frame) => `Missing \`@since\` tag in file ${filePath}:\n\n${frame}` |
| 67 | )) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return errors |
| 72 | }) |
| 73 | } |
| 74 | |
| 75 | function checkEntries(models: ReadonlyArray<Entry>, options: { |
| 76 | readonly enforceVersion: boolean |
no test coverage detected