diff --git a/server/gx-workflow-ls-format2/src/profiles.ts b/server/gx-workflow-ls-format2/src/profiles.ts index 6585d97..b45d27c 100644 --- a/server/gx-workflow-ls-format2/src/profiles.ts +++ b/server/gx-workflow-ls-format2/src/profiles.ts @@ -3,7 +3,7 @@ import { BasicCommonValidationProfile, IWCCommonValidationProfile, } from "@gxwf/server-common/src/providers/validation/profiles"; -import { MissingPropertyValidationRule } from "@gxwf/server-common/src/providers/validation/rules"; +import { RequiredPropertyValidationRule } from "@gxwf/server-common/src/providers/validation/rules"; /** * Defines the minimal set of validation rules for gxformat2 Galaxy workflows. @@ -28,7 +28,7 @@ export class GxFormat2IWCValidationProfile extends IWCCommonValidationProfile { protected static readonly RULES = new Set([ ...super.RULES, ...GxFormat2BasicValidationProfile.RULES, - new MissingPropertyValidationRule( + new RequiredPropertyValidationRule( "doc", true, DiagnosticSeverity.Error, diff --git a/server/gx-workflow-ls-native/src/profiles.ts b/server/gx-workflow-ls-native/src/profiles.ts index f75d342..8af2fdb 100644 --- a/server/gx-workflow-ls-native/src/profiles.ts +++ b/server/gx-workflow-ls-native/src/profiles.ts @@ -3,7 +3,7 @@ import { BasicCommonValidationProfile, IWCCommonValidationProfile, } from "@gxwf/server-common/src/providers/validation/profiles"; -import { MissingPropertyValidationRule } from "@gxwf/server-common/src/providers/validation/rules"; +import { RequiredPropertyValidationRule } from "@gxwf/server-common/src/providers/validation/rules"; import { WorkflowOutputLabelValidationRule } from "./validation/rules/WorkflowOutputLabelValidationRule"; /** @@ -29,7 +29,7 @@ export class NativeIWCValidationProfile extends IWCCommonValidationProfile { protected static readonly RULES = new Set([ ...super.RULES, ...NativeBasicValidationProfile.RULES, - new MissingPropertyValidationRule( + new RequiredPropertyValidationRule( "annotation", true, DiagnosticSeverity.Error, diff --git a/server/gx-workflow-ls-native/tests/unit/customValidationRules.test.ts b/server/gx-workflow-ls-native/tests/unit/customValidationRules.test.ts index 27f8d78..c2696a9 100644 --- a/server/gx-workflow-ls-native/tests/unit/customValidationRules.test.ts +++ b/server/gx-workflow-ls-native/tests/unit/customValidationRules.test.ts @@ -1,5 +1,5 @@ import { DiagnosticSeverity, ValidationRule } from "@gxwf/server-common/src/languageTypes"; -import { MissingPropertyValidationRule } from "@gxwf/server-common/src/providers/validation/rules"; +import { RequiredPropertyValidationRule } from "@gxwf/server-common/src/providers/validation/rules"; import { WorkflowOutputLabelValidationRule } from "../../src/validation/rules/WorkflowOutputLabelValidationRule"; import { createNativeWorkflowDocument } from "../testHelpers"; import { TestWorkflowProvider } from "../testWorkflowProvider"; @@ -46,7 +46,7 @@ describe("Custom Validation Rules", () => { describe("MissingPropertyValidation Rule", () => { beforeAll(() => { - rule = new MissingPropertyValidationRule("release"); + rule = new RequiredPropertyValidationRule("release"); }); it("should not provide diagnostics when the property is present", async () => { @@ -83,7 +83,7 @@ describe("Custom Validation Rules", () => { }); it("should provide warning diagnostics when the property is missing and severity is set to warning", async () => { - rule = new MissingPropertyValidationRule("release", true, DiagnosticSeverity.Warning); + rule = new RequiredPropertyValidationRule("release", true, DiagnosticSeverity.Warning); const wfContents = `{ "a_galaxy_workflow": "true", }`; @@ -95,7 +95,7 @@ describe("Custom Validation Rules", () => { }); it("should display a custom message when provided", async () => { - rule = new MissingPropertyValidationRule("release", true, DiagnosticSeverity.Warning, "Custom message"); + rule = new RequiredPropertyValidationRule("release", true, DiagnosticSeverity.Warning, "Custom message"); const wfContents = `{ "a_galaxy_workflow": "true", }`; @@ -108,7 +108,7 @@ describe("Custom Validation Rules", () => { describe("when valueRequired is false", () => { beforeAll(() => { - rule = new MissingPropertyValidationRule("release", false); + rule = new RequiredPropertyValidationRule("release", false); }); it("should not provide diagnostics when the property is present", async () => { @@ -145,7 +145,7 @@ describe("Custom Validation Rules", () => { describe("when the property is an array", () => { beforeAll(() => { - rule = new MissingPropertyValidationRule("creator"); + rule = new RequiredPropertyValidationRule("creator"); }); it("should not provide diagnostics when the property has a value", async () => { @@ -173,7 +173,7 @@ describe("Custom Validation Rules", () => { describe("when the property is an object", () => { beforeAll(() => { - rule = new MissingPropertyValidationRule("steps"); + rule = new RequiredPropertyValidationRule("steps"); }); it("should not provide diagnostics when the property has a value", async () => { @@ -201,7 +201,7 @@ describe("Custom Validation Rules", () => { describe("when the property is nested", () => { beforeAll(() => { - rule = new MissingPropertyValidationRule("steps/0/tool_id"); + rule = new RequiredPropertyValidationRule("steps/0/tool_id"); }); it("should not provide diagnostics when the property has a value", async () => { diff --git a/server/packages/server-common/src/providers/validation/profiles.ts b/server/packages/server-common/src/providers/validation/profiles.ts index 02a4380..4bf44f9 100644 --- a/server/packages/server-common/src/providers/validation/profiles.ts +++ b/server/packages/server-common/src/providers/validation/profiles.ts @@ -1,5 +1,5 @@ import { DiagnosticSeverity, ValidationProfile, ValidationRule } from "../../languageTypes"; -import { MissingPropertyValidationRule, StepExportErrorValidationRule, TestToolshedValidationRule } from "./rules"; +import { RequiredPropertyValidationRule, StepExportErrorValidationRule, TestToolshedValidationRule } from "./rules"; /** * The *NoOp* validation profile. @@ -38,19 +38,19 @@ export class IWCCommonValidationProfile implements ValidationProfile { public readonly name: string = "IWC Best Practices"; protected static readonly RULES: Set = new Set([ - new MissingPropertyValidationRule( + new RequiredPropertyValidationRule( "release", true, DiagnosticSeverity.Error, "The workflow must have a release version." ), - new MissingPropertyValidationRule( + new RequiredPropertyValidationRule( "creator", true, DiagnosticSeverity.Error, "The workflow does not specify a creator." ), - new MissingPropertyValidationRule( + new RequiredPropertyValidationRule( "license", true, DiagnosticSeverity.Error, diff --git a/server/packages/server-common/src/providers/validation/rules/MissingPropertyValidation.ts b/server/packages/server-common/src/providers/validation/rules/MissingPropertyValidation.ts index 7305da5..47ae65f 100644 --- a/server/packages/server-common/src/providers/validation/rules/MissingPropertyValidation.ts +++ b/server/packages/server-common/src/providers/validation/rules/MissingPropertyValidation.ts @@ -11,7 +11,7 @@ import { DocumentContext, ValidationRule } from "../../../languageTypes"; * property is an object or an array, the rule will also check that it has at * least one property or item. */ -export class MissingPropertyValidationRule implements ValidationRule { +export class RequiredPropertyValidationRule implements ValidationRule { constructor( private nodePath: string, private valueRequired: boolean = true, diff --git a/server/packages/server-common/src/providers/validation/rules/index.ts b/server/packages/server-common/src/providers/validation/rules/index.ts index fa1a219..b200b05 100644 --- a/server/packages/server-common/src/providers/validation/rules/index.ts +++ b/server/packages/server-common/src/providers/validation/rules/index.ts @@ -1,5 +1,5 @@ -import { MissingPropertyValidationRule } from "./MissingPropertyValidation"; +import { RequiredPropertyValidationRule } from "./MissingPropertyValidation"; import { StepExportErrorValidationRule } from "./StepErrorValidationRule"; import { TestToolshedValidationRule } from "./TestToolShedValidationRule"; -export { MissingPropertyValidationRule, StepExportErrorValidationRule, TestToolshedValidationRule }; +export { RequiredPropertyValidationRule, StepExportErrorValidationRule, TestToolshedValidationRule }; diff --git a/server/packages/workflow-tests-language-service/src/profiles.ts b/server/packages/workflow-tests-language-service/src/profiles.ts index fbfcb36..9f086d4 100644 --- a/server/packages/workflow-tests-language-service/src/profiles.ts +++ b/server/packages/workflow-tests-language-service/src/profiles.ts @@ -3,7 +3,7 @@ import { BasicCommonValidationProfile, IWCCommonValidationProfile, } from "@gxwf/server-common/src/providers/validation/profiles"; -import { MissingPropertyValidationRule } from "@gxwf/server-common/src/providers/validation/rules"; +import { RequiredPropertyValidationRule } from "@gxwf/server-common/src/providers/validation/rules"; import { WorkflowInputsValidationRule } from "./validation/rules/WorkflowInputsValidationRule"; import { WorkflowOutputsValidationRule } from "./validation/rules/WorkflowOutputsValidationRule"; @@ -30,13 +30,13 @@ export class TestDocumentBasicValidationProfile extends BasicCommonValidationPro */ export class TestDocumentIWCValidationProfile extends IWCCommonValidationProfile { protected static readonly RULES = new Set([ - ...super.RULES, ...TestDocumentBasicValidationProfile.RULES, - new MissingPropertyValidationRule( + // TODO: This rule needs to be updated to check for the presence of the `doc` property in each test. + new RequiredPropertyValidationRule( "doc", true, DiagnosticSeverity.Error, - "The workflow is not documented. Documenting workflows helps users understand the purpose of the workflow." + "The workflow test is not documented. Documenting workflows helps users understand the purpose of the workflow." ), // Add more custom rules specific to native workflows here... ]);