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

Updated nf-core modules remove to remove entry in modules.json #1132

Merged
merged 4 commits into from
Jun 28, 2021

Conversation

ErikDanielsson
Copy link
Contributor

@ErikDanielsson ErikDanielsson commented Jun 28, 2021

Updated nf-core modules remove to remove entry in modules.json as suggested in #1115. If entry is missing from modules.json the user is asked if they want to continue removing the module directory.

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

@codecov
Copy link

codecov bot commented Jun 28, 2021

Codecov Report

Merging #1132 (bb17413) into dev (03f1127) will decrease coverage by 0.00%.
The diff coverage is 70.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1132      +/-   ##
==========================================
- Coverage   70.58%   70.57%   -0.01%     
==========================================
  Files          48       48              
  Lines        4827     4843      +16     
==========================================
+ Hits         3407     3418      +11     
- Misses       1420     1425       +5     
Impacted Files Coverage Δ
nf_core/modules/remove.py 77.08% <70.58%> (-4.17%) ⬇️

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 03f1127...bb17413. Read the comment docs.

Copy link
Contributor

@KevinMenden KevinMenden left a comment

Choose a reason for hiding this comment

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

Looks good @ErikDanielsson ! Just a few tiny suggestions otherwise good to go, thanks! 👍

Comment on lines 79 to 81
return questionary.confirm(
f"Do you wish to continue removing module '{module}'?", default=False
).unsafe_ask()
Copy link
Contributor

Choose a reason for hiding this comment

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

I would say we don't need a prompt here, maybe just say that a modules.json is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I guess we can rely on the user knowing rm -rf atleast.

Comment on lines 62 to 63
if not self.remove_modules_json_entry(module):
return False
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to the other command, I would rather print that the module entry couldn't be found in the modules.json and not prompt for it.

Comment on lines 70 to 72
modules_json_path = os.path.join(self.dir, "modules.json")
with open(modules_json_path, "r") as fh:
modules_json = json.load(fh)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably verify that the modules.json and catch the exception if it doesn't to still remove the module. Just to be sure, for the initial phase ... maybe some people won't have the file. Although I think that the transition will be really fast.

Copy link
Contributor Author

@ErikDanielsson ErikDanielsson Jun 28, 2021

Choose a reason for hiding this comment

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

I thought about it, but didn't add it in the end since we check for the file in has_valid_pipeline. But I guess it doesn't do any harm checking for it, and if the code is changed at some point it might cause errors.

@ErikDanielsson ErikDanielsson merged commit 19688de into nf-core:dev Jun 28, 2021
@ErikDanielsson ErikDanielsson deleted the update-modules-remove branch July 25, 2022 09:02
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