* Creates a listener to track errors emitted
(opts: DocutilsValidatorOpts = {})
| 136 | * Creates a listener to track errors emitted |
| 137 | */ |
| 138 | constructor(opts: DocutilsValidatorOpts = {}) { |
| 139 | super(); |
| 140 | |
| 141 | this.pythonPath = opts.pythonPath; |
| 142 | this.cwd = opts.cwd ?? process.cwd(); |
| 143 | this.mkDocsYmlPath = opts.mkdocsYml; |
| 144 | |
| 145 | if (opts.python) { |
| 146 | this.validations.add(NAME_PYTHON); |
| 147 | } |
| 148 | if (opts.mkdocs) { |
| 149 | this.validations.add(NAME_MKDOCS); |
| 150 | } |
| 151 | |
| 152 | // this just tracks the emitted errors |
| 153 | this.on(DocutilsValidator.FAILURE, (err: DocutilsError) => { |
| 154 | this.emittedErrors.set(err.message, err); |
| 155 | }); |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Runs the configured validations, then resets internal state upon completion or rejection. |