fix(watch): make sure watch doesn't skip not passing exercises if you change a previous one #1175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi. Thanks for all the rustling exercises, I loved working on them 🦀
I started with a local git clone of this repo and ran
rustlings watch
. During my journey I did not solve all of the tasks at once, and sometimes a whole week went away before I got time to open it up again. Hence, I always started with rebasing my local "solutions" branch onto the latest release - first one was 4.8 and I finished the course with 5.2.0. During the rebases I got some conflicts I had to resolve - no problem, I thought I can do it by runningrustlings watch
and fix broken files. However, it did not work as I imagined: after I solved the first broken file with conflicts in it, the watch command skipped all the other broken files and told me that I'm ready to learn something new. In case I restarted the watcher, it always picked the first broken exercise and skipped the others when I was ready with that one due to the missing// I AM NOT DONE
comments.In my fix I split the exercises into two arrays: the ones before the current file and the ones after it. The exercises in the first group could be skipped when they look done because the watcher already built them since their last modification. However, the files after the current exercise shouldn't be handled as done because we haven't verified yet that they are passing.
I hope this makes sense and you'll find my PR helpful.