MCPcopy Create free account
hub / github.com/appium/appium / validateMkDocsConfig

Method validateMkDocsConfig

packages/docutils/lib/validate.ts:283–309  ·  view source on GitHub ↗

* Validates (sort of) an `mkdocs.yml` config file. * * It checks if the file exists, if it can be parsed as YAML, and if it has a `site_name` property.

()

Source from the content-addressed store, hash-verified

281 * It checks if the file exists, if it can be parsed as YAML, and if it has a `site_name` property.
282 */
283 protected async validateMkDocsConfig() {
284 log.debug(`Validating ${NAME_MKDOCS_YML}`);
285
286 const mkDocsYmlPath = this.mkDocsYmlPath ?? (await findMkDocsYml(this.cwd));
287 if (!mkDocsYmlPath) {
288 return this.fail(`Could not find ${NAME_MKDOCS_YML} from ${this.cwd}; please run "${NAME_BIN} init"`);
289 }
290
291 let mkDocsYml: MkDocsYml;
292 try {
293 mkDocsYml = await readMkDocsYml(mkDocsYmlPath);
294 } catch (e) {
295 const err = e as NodeJS.ErrnoException;
296 if (err.code === NAME_ERR_ENOENT) {
297 return this.fail(
298 `Could not find ${NAME_MKDOCS_YML} at ${mkDocsYmlPath}. Use --mkdocs-yml to specify a different path.`,
299 );
300 }
301 return this.fail(`Could not parse ${mkDocsYmlPath}: ${err}`);
302 }
303
304 if (!mkDocsYml.site_name) {
305 return this.fail(`Could not find required property "site_name" in ${mkDocsYmlPath}`);
306 }
307
308 this.ok(`MkDocs config at ${mkDocsYmlPath} OK`);
309 }
310
311 /**
312 * Asserts that the dependencies as listed in `requirements.txt` are installed.

Callers 1

validateMethod · 0.95

Calls 3

failMethod · 0.95
okMethod · 0.95
debugMethod · 0.65

Tested by

no test coverage detected