Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: swap default behaviour for fail fast #46

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

dnlbauer
Copy link
Contributor

The default behaviour of fail fast is currently to always fail fast.

#42 (comment) discussed that this could be swapped to not fail fast by default. This PR implements this behaviour by changing -nff to -ff for "fail-fast"

I personally feel that this is a more sensible default behaviour for CLI, since users are likely interested in knowing everything that is wrong with their crate.

With this PR, options look like this:

> rocrate-validator validate --help
                                                                                                                                                                                                              
 Usage: rocrate-validator validate [OPTIONS] [ROCRATE_URI]                                                                                                                                                    
                                                                                                                                                                                                              
 rocrate-validator: Validate a RO-Crate against a profile 

╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --fail-fast                    -ff                                   Fail fast validation mode
(...)
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

And work as expected:

> rocrate-validator validate -f json -p workflow-run-crate-0.5 .
{
    "meta": {
        "version": "0.1"
    },
    "validation_settings": {
        "profile_identifier": "workflow-run-crate-0.5",
        "enable_profile_inheritance": true,
        "abort_on_first": false,
        "requirement_severity": "REQUIRED",
        "rocrate_validator_version": "0.4.6_26877b5+0-dirty"
    },
    "passed": false,
    "issues": [
        {
            "severity": "REQUIRED",
            "message": "The Main Workflow must refer to its language via programmingLanguage",
            "violatingEntity": "./workflow.yaml",
            "violatingProperty": "http://schema.org/programmingLanguage",
            "violatingPropertyValue": null,
            "check": {
                "identifier": "workflow-ro-crate-1.0_2.2",
                "label": "MUST 2.2",
                "order": 2,
                "name": "Main Workflow language",
                "description": "The Main Workflow must refer to its language via programmingLanguage",
                "severity": "REQUIRED",
                "requirement": {
                    "identifier": "workflow-ro-crate-1.0_2",
                    "name": "Main Workflow definition",
                    "description": "Main Workflow properties defined as MUST",
                    "order": 2,
                    "profile": {
                        "identifier": "workflow-ro-crate-1.0",
                        "uri": "https://w3id.org/workflowhub/workflow-ro-crate/1.0",
                        "name": "Workflow RO-Crate Metadata Specification 1.0",
                        "description": "Workflow RO-Crate Metadata Specification."
                    }
                }
            }
        },
        {
            "severity": "REQUIRED",
            "message": "The Root Data Entity MUST reference a CreativeWork entity with an @id URI that is consistent with the versioned permalink of the Workflow Run Crate profile",
            "violatingEntity": "./",
            "violatingProperty": "http://purl.org/dc/terms/conformsTo",
            "violatingPropertyValue": null,
            "check": {
                "identifier": "workflow-run-crate-0.5_2.1",
                "label": "MUST 2.1",
                "order": 1,
                "name": "Root Data Entity conformsTo",
                "description": "The Root Data Entity MUST reference a CreativeWork entity with an @id URI that is consistent with the versioned permalink of the Workflow Run Crate profile",
                "severity": "REQUIRED",
                "requirement": {
                    "identifier": "workflow-run-crate-0.5_2",
                    "name": "Root Data Entity Metadata",
                    "description": "Properties of the Root Data Entity",
                    "order": 2,
                    "profile": {
                        "identifier": "workflow-run-crate-0.5",
                        "uri": "https://w3id.org/ro/wfrun/workflow/0.5",
                        "name": "Workflow Run Crate 0.5",
                        "description": "Workflow Run Crate Metadata Specification 0.5"
                    }
                }
            }
        }
    ]
}

vs.

> rocrate-validator validate -ff -f json -p workflow-run-crate-0.5 .
{
    "meta": {
        "version": "0.1"
    },
    "validation_settings": {
        "profile_identifier": "workflow-run-crate-0.5",
        "enable_profile_inheritance": true,
        "abort_on_first": true,
        "requirement_severity": "REQUIRED",
        "rocrate_validator_version": "0.4.6_26877b5+0-dirty"
    },
    "passed": false,
    "issues": [
        {
            "severity": "REQUIRED",
            "message": "The Root Data Entity MUST reference a CreativeWork entity with an @id URI that is consistent with the versioned permalink of the Workflow Run Crate profile",
            "violatingEntity": "./",
            "violatingProperty": "http://purl.org/dc/terms/conformsTo",
            "violatingPropertyValue": null,
            "check": {
                "identifier": "workflow-run-crate-0.5_2.1",
                "label": "MUST 2.1",
                "order": 1,
                "name": "Root Data Entity conformsTo",
                "description": "The Root Data Entity MUST reference a CreativeWork entity with an @id URI that is consistent with the versioned permalink of the Workflow Run Crate profile",
                "severity": "REQUIRED",
                "requirement": {
                    "identifier": "workflow-run-crate-0.5_2",
                    "name": "Root Data Entity Metadata",
                    "description": "Properties of the Root Data Entity",
                    "order": 2,
                    "profile": {
                        "identifier": "workflow-run-crate-0.5",
                        "uri": "https://w3id.org/ro/wfrun/workflow/0.5",
                        "name": "Workflow Run Crate 0.5",
                        "description": "Workflow Run Crate Metadata Specification 0.5"
                    }
                }
            }
        }
    ]
}

@kikkomep
Copy link
Member

kikkomep commented Dec 2, 2024

Looks good to me. Thank you @dnlbauer

@kikkomep kikkomep merged commit 51fdc32 into crs4:develop Dec 2, 2024
2 checks passed
@dnlbauer dnlbauer deleted the change_default_to_fail_fast branch December 2, 2024 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants