Skip to content

YamlParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/config-docs/yaml.parser.ts

YAML Parser implementation

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(_config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • YamlParser stops the work with an early return when fileName.includes('docker-compose') || fileName.includes('compose.y').
  • YamlParser stops the work with an early return when firstDoc['services'] || firstDoc['version'].
  • YamlParser stops the work with an early return when fileName.includes('.github/workflows/') || fileName.includes('/.github/workflows/').
  • YamlParser stops the work with an early return when firstDoc['on'] && firstDoc['jobs'].
  • YamlParser stops the work with an early return when fileName.includes('.gitlab-ci').
  • YamlParser stops the work with an early return when firstDoc['stages'] || firstDoc['image'].

When something fails

  • YamlParser handles failure in 2 places: it logs it and continues in 1, and turns it into a return value in 1.

Was this page helpful?

Download as PDF