Skip to content

Commit

Permalink
Refactor validation profiles to include descriptive names
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Jun 20, 2024
1 parent 815b7d9 commit f75858d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions server/gx-workflow-ls-format2/src/profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { InputTypeValidationRule } from "./validation/rules/InputTypeValidationR
* Defines the minimal set of validation rules for gxformat2 Galaxy workflows.
*/
export class GxFormat2BasicValidationProfile extends BasicCommonValidationProfile {
public readonly name: string = "GxFormat2 Validation";
public static readonly RULES = new Set([
...super.RULES,
// Add more custom rules specific to gxformat2 workflows here...
Expand Down
1 change: 1 addition & 0 deletions server/gx-workflow-ls-native/src/profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { WorkflowOutputLabelValidationRule } from "./validation/rules/WorkflowOu
* Defines the minimal set of validation rules for Native Galaxy workflows.
*/
export class NativeBasicValidationProfile extends BasicCommonValidationProfile {
public readonly name: string = "Workflow Validation";
public static readonly RULES = new Set([
...super.RULES,
// Add more custom rules specific to native workflows here...
Expand Down
2 changes: 1 addition & 1 deletion server/packages/server-common/src/languageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export abstract class LanguageServiceBase<T extends DocumentContext> implements
for (const rule of profile.rules) {
const contributedDiagnostics = await rule.validate(documentContext);
contributedDiagnostics.forEach((diagnostic) => {
diagnostic.source = profile.name;
diagnostic.source = diagnostic.source ?? profile.name;
});
diagnostics.push(...contributedDiagnostics);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class NoOpValidationProfile implements ValidationProfile {
* Common set of validation rules for basic validation of any workflow format.
*/
export class BasicCommonValidationProfile implements ValidationProfile {
public readonly name: string = "Basic Validation";
public readonly name: string = "Workflow Validator";

protected static readonly RULES: Set<ValidationRule> = new Set([
new TestToolshedValidationRule(DiagnosticSeverity.Error),
Expand Down
11 changes: 4 additions & 7 deletions server/packages/workflow-tests-language-service/src/profiles.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { DiagnosticSeverity, ValidationRule } from "@gxwf/server-common/src/languageTypes";
import {
BasicCommonValidationProfile,
IWCCommonValidationProfile,
} from "@gxwf/server-common/src/providers/validation/profiles";
import { DiagnosticSeverity, ValidationProfile, ValidationRule } from "@gxwf/server-common/src/languageTypes";
import { IWCCommonValidationProfile } from "@gxwf/server-common/src/providers/validation/profiles";
import { RequiredArrayPropertyValidationRule } from "@gxwf/server-common/src/providers/validation/rules";
import { WorkflowInputsValidationRule } from "./validation/rules/WorkflowInputsValidationRule";
import { WorkflowOutputsValidationRule } from "./validation/rules/WorkflowOutputsValidationRule";

/**
* Defines the minimal set of validation rules for Galaxy Workflow Tests Documents.
*/
export class TestDocumentBasicValidationProfile extends BasicCommonValidationProfile {
export class TestDocumentBasicValidationProfile implements ValidationProfile {
public readonly name: string = "Test Document Validator";
public static readonly RULES = new Set([
...super.RULES,
new WorkflowInputsValidationRule(DiagnosticSeverity.Error),
new WorkflowOutputsValidationRule(DiagnosticSeverity.Error),
// Add more custom rules specific to native workflows here...
Expand Down

0 comments on commit f75858d

Please sign in to comment.