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

REF: More detailed runtime checks for input spec #627

Merged
merged 2 commits into from
Mar 9, 2023

Conversation

ghisvail
Copy link
Collaborator

@ghisvail ghisvail commented Mar 9, 2023

Whilst working on #619, I had a hard time figuring out how runtime checks were working in the input spec.

I took this opportunity to break the checks down into more digestible chunks, with intermediate variables and more meaningful names. In addition, we are now getting the list of alternative fields to set in case a mandatory argument is unset but declare other fields in xor, instead of just reporting the field as mandatory but unset.

On a more general note, I would have expected to find these checks in ShellSpec, since the specific metadata we are manipulating only make sense in this context. Food for thoughts for a wider refactoring maybe.

Types of changes

  • Refactoring (non-breaking change, does not fix an issue)

Checklist

  • I have added tests to cover my changes (if necessary)
  • I have updated documentation (if necessary)

@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.06 ⚠️

Comparison is base (374cdec) 81.76% compared to head (082e600) 81.70%.

❗ Current head 082e600 differs from pull request most recent head 32432c3. Consider uploading reports for the commit 32432c3 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #627      +/-   ##
==========================================
- Coverage   81.76%   81.70%   -0.06%     
==========================================
  Files          20       20              
  Lines        4392     4390       -2     
  Branches     1264        0    -1264     
==========================================
- Hits         3591     3587       -4     
- Misses        797      803       +6     
+ Partials        4        0       -4     
Flag Coverage Δ
unittests 81.70% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pydra/engine/specs.py 94.74% <100.00%> (-0.03%) ⬇️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@effigies
Copy link
Contributor

effigies commented Mar 9, 2023

Deleted some bad suggestions. Will do normal review so you don't see the noise.

Copy link
Contributor

@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.

The logic looks good. I have some suggestions that I put in a commit that I think make it a little easier to follow (2eb09b7).

First we check whether we need to look at alternatives or requires. Then we look at alternatives. Then we look at requires. The behavior doesn't change (except the specific text of an error message). Your logic looks good overall.

Note that I changed if x and any(x.values()), to if any(x.values()), as that will return False on an empty sequence. Same with not all(x.values()).

@ghisvail ghisvail force-pushed the ref/input-spec-check branch 2 times, most recently from dc22246 to 6075df9 Compare March 9, 2023 18:00
@ghisvail
Copy link
Collaborator Author

ghisvail commented Mar 9, 2023

The logic looks good. I have some suggestions that I put in a commit that I think make it a little easier to follow (2eb09b7).

I like them. I added them on your behalf in a follow-up commit.

@ghisvail ghisvail merged commit 7b4837c into nipype:master Mar 9, 2023
@ghisvail ghisvail deleted the ref/input-spec-check branch March 9, 2023 19:37
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.

None yet

2 participants