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

UX: Check argument validity of --as-common-datasrc name #5805

Merged
merged 2 commits into from Jul 23, 2021

Conversation

adswa
Copy link
Member

@adswa adswa commented Jul 22, 2021

This PR adds a ValueError that is raised as a validity check when a user supplies identical names for a remote sibling name and the autoenabled as_common_datasrc special remote, as done in #5621.

Fixes #5621

…name are not identical

Fixes datalad#5621 by catching identically named remotes early, and raising a ValueError
@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Merging #5805 (aad58a5) into master (97f055b) will decrease coverage by 61.37%.
The diff coverage is 0.00%.

❗ Current head aad58a5 differs from pull request most recent head ca4bd59. Consider uploading reports for the commit ca4bd59 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           master    #5805       +/-   ##
===========================================
- Coverage   90.64%   29.27%   -61.38%     
===========================================
  Files         309      306        -3     
  Lines       42436    42403       -33     
===========================================
- Hits        38468    12413    -26055     
- Misses       3968    29990    +26022     
Impacted Files Coverage Δ
datalad/distribution/siblings.py 15.33% <0.00%> (-65.67%) ⬇️
datalad/distribution/tests/test_siblings.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/wtf.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/addurls.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test_api.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/no_annex.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/support/digests.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test_base.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/add_readme.py 0.00% <0.00%> (-100.00%) ⬇️
... and 260 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 97f055b...ca4bd59. Read the comment docs.

Copy link
Member

@mih mih left a comment

Choose a reason for hiding this comment

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

I was torn re exception vs error. The existing code uses both (I could not detect a clear pattern). Given that the name clash can only occur based on input arguments (rather than dataset properties), I think it is preferable to use an exception -- like you did. I also agree with the choice of exception type (ValueError rather than InsufficientArgumentsError which seems prevalent in this code, but often doesn't fit IMHO).

@yarikoptic
Copy link
Member

logic sounds logical, and I agree with @mih that ValueError as an exception for a misspecified entry (as for no entry at all) is the correct one . Let's proceed. Thank you @adswa !

@yarikoptic yarikoptic merged commit 7cbfebc into datalad:master Jul 23, 2021
@yarikoptic
Copy link
Member

but may be this and such fixes should go against maint still to possibly benefit "more"

@yarikoptic yarikoptic added cherry-pick-to-maint semver-patch Increment the patch version when merged labels Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-to-maint semver-patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

siblings should check argument validity of --as-common-datasrc
3 participants