Name the --overwrite flag in file-exists errors - #749
Conversation
Both messages told the user to pass '-o', which the CLI does not define. Closes #748 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hfn8dhw9cwP5FiVaCgFmCt
h-mayorquin
left a comment
There was a problem hiding this comment.
The fix is good, thanks for catching this (the message was sending people to a flag that errors out!).
One thing we could improve here. Both existence checks run after the whole inspection is done. The json_file_path one is after messages = list(messages_iterator) and the save_report one is later still, and neither of them needs the messages, they are only looking at a path. If we move them up to the top with the rest of the argument handling then a user who points --json-file-path at a file that already exists finds out right away instead of after scanning a whole dandiset.
That would also make test_cli_existing_json_file_message_names_overwrite_flag a lot lighter. Right now it writes an NWB file with NWBHDF5IO and runs the whole CLI to check a substring, and with the check at the top it does not need a file at all.
Mechanical conflict resolution: CHANGELOG.md [changelog]
The changelog is now assembled from one file per entry (#764), so the entry moves out of CHANGELOG.md into a file named after this pull request. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Both existence checks ran after the whole inspection, so a user who pointed --json-file-path or --report-file-path at an existing file found out only after scanning a whole folder or dandiset. They now run with the rest of the argument handling, and the CLI tests no longer need an NWB file to reach them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Good call. Both checks now run with the rest of the argument handling, before anything is inspected, and they cover |
h-mayorquin
left a comment
There was a problem hiding this comment.
LGTM, thanks for addressing the feedback.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #749 +/- ##
==========================================
+ Coverage 81.26% 88.90% +7.64%
==========================================
Files 48 48
Lines 1916 1938 +22
==========================================
+ Hits 1557 1723 +166
+ Misses 359 215 -144
🚀 New features to boost your workflow:
|
Fixes #748.
The "already exists" errors raised by
save_reportand by the CLI for--json-file-pathtold the user to pass-o, which is not a flag the CLI defines. Both now say--overwrite.One test calls
save_reportagainst an existing file and matches on--overwrite; the other drives the CLI with click'sCliRunneragainst an existing JSON path and checks the exception text. Both fail ondev.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hfn8dhw9cwP5FiVaCgFmCt