validate_actions.pipeline_stages.parser¶
Parser for YAML files, from input file to Python data structure representation.
Classes
|
YAML parser implementation using PyYAML. |
|
Abstract base class for parsing GitHub Actions workflow YAML files. |
- class validate_actions.pipeline_stages.parser.YAMLParser(problems)[source]¶
Bases:
ProcessStage[Path,Dict[String,Any]]Abstract base class for parsing GitHub Actions workflow YAML files.
This parser performs token-level parsing to enable precise position tracking and auto-fixing of workflow files. The parser maintains exact line, column, and character positions for all parsed elements to support:
Validation rule error reporting with precise locations
Auto-fixing of problems using character-level edits
Expression parsing within ${{ }} syntax
Structured AST construction for downstream pipeline stages
- Parameters:
problems (Problems)
- abstractmethod process(file)[source]¶
Parse a GitHub Actions workflow YAML file into a structured representation.
Converts YAML content into a dictionary with String keys that preserve position information for validation and auto-fixing. Handles GitHub Actions-specific constructs including expressions and complex nested structures.
- Parameters:
file (Path) – Path to the GitHub Actions workflow YAML file to parse.
- Returns:
- Parsed YAML as dictionary with position-aware String
keys and values. Returns empty dict if parsing fails or file is invalid.
- Return type:
Dict[String, Any]
- class validate_actions.pipeline_stages.parser.PyYAMLParser(problems)[source]¶
Bases:
YAMLParserYAML parser implementation using PyYAML.
- Parameters:
problems (Problems)