Skip to content

Commit

Permalink
Fix StepErrorValidationRule
Browse files Browse the repository at this point in the history
- Do not report null values
- Include correct error value in diagnostic message
- Use given severity instead of hardcoded warning
  • Loading branch information
davelopez committed Jun 21, 2024
1 parent 433960c commit 085032f
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ export class StepExportErrorValidationRule implements ValidationRule {
public async validate(documentContext: DocumentContext): Promise<Diagnostic[]> {
const diagnostics: Diagnostic[] = [];
const steps = documentContext.nodeManager.getStepNodes(true);
steps.forEach((step) => {
for (const step of steps) {
const errors = step.properties.find((p) => p.keyNode.value === "errors");
if (errors) {
if (errors && errors.valueNode && errors.valueNode.type !== "null") {
const range = documentContext.nodeManager.getNodeRange(errors);
const valueRange = documentContext.nodeManager.getNodeRange(errors.valueNode);
const errorValue = documentContext.textDocument.getText(valueRange);
diagnostics.push(
Diagnostic.create(
range,
`Tool step contains error indicated during Galaxy export - ${errors}`,
DiagnosticSeverity.Warning
`Tool step contains error indicated during Galaxy export - ${errorValue}`,
this.severity
)
);
}
});
}
return Promise.resolve(diagnostics);
}
}

0 comments on commit 085032f

Please sign in to comment.