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

[SCHEMA] Check sidecar fields mentioned in rule checks exist in the schema #1917

Merged
merged 4 commits into from
Aug 30, 2024

Conversation

Remi-Gau
Copy link
Collaborator

@@ -77,3 +86,67 @@ def test_checks(schema_obj):
def test_expected_failures(expr):
with pytest.raises(ParseException):
expression.parse_string(expr)


def test_valid_sidecar_field(schema_obj):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sort of totally improvised testing this, so there may be a simpler way to do this.

@Remi-Gau
Copy link
Collaborator Author

FYI this actually caught a few typos or things that had not been updated in the schema.

@Remi-Gau Remi-Gau requested a review from effigies August 30, 2024 08:54
@Remi-Gau Remi-Gau added exclude-from-changelog This item will not feature in the automatically generated changelog schema-code Updates or changes to the code used to parse, filter, and render the schema. labels Aug 30, 2024
Copy link

codecov bot commented Aug 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.23%. Comparing base (7f1f673) to head (ed1c597).
Report is 113 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1917   +/-   ##
=======================================
  Coverage   87.23%   87.23%           
=======================================
  Files          16       16           
  Lines        1410     1410           
=======================================
  Hits         1230     1230           
  Misses        180      180           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@effigies effigies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Largely rewrote to fetch any identifier, whether it's a bare (suffix), a function name (exists) or a property (nifti_header.dims). This way we can add more checks easily at the top level.

I'm not going to bog this PR down with other checks, but, for example, we could make sure that nifti_header fields exist in schema.meta.context.properties.nifti_header.properties, or schema.* can be found in the schema itself.

I didn't find any new typos from what you already found by expanding to all rules that include selectors.

@effigies effigies merged commit ede9b30 into bids-standard:master Aug 30, 2024
27 checks passed
@Remi-Gau Remi-Gau deleted the check_metadata branch August 30, 2024 17:01
@Remi-Gau
Copy link
Collaborator Author

Thanks for the review and expansion.
At least this provides a framework to expand on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude-from-changelog This item will not feature in the automatically generated changelog schema-code Updates or changes to the code used to parse, filter, and render the schema.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants