MCPcopy Create free account
hub / github.com/Effect-TS/effect / checkEntry

Function checkEntry

packages/tools/docgen/src/Checker.ts:28–73  ·  view source on GitHub ↗
(model: Entry, options: {
  readonly enforceVersion: boolean
})

Source from the content-addressed store, hash-verified

26}
27
28function 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
75function checkEntries(models: ReadonlyArray<Entry>, options: {
76 readonly enforceVersion: boolean

Callers 8

checkEntriesFunction · 0.85
checkFunctionFunction · 0.85
checkClassFunction · 0.85
checkConstantFunction · 0.85
checkInterfaceFunction · 0.85
checkTypeAliasFunction · 0.85
checkNamespaceFunction · 0.85
checkExportFunction · 0.85

Calls 1

makeErrorFunction · 0.85

Tested by

no test coverage detected