-
-
Notifications
You must be signed in to change notification settings - Fork 158
EndingBlankLineChecker: refactor last line check logic #207
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #207 +/- ##
==========================================
- Coverage 96.76% 96.57% -0.19%
==========================================
Files 15 15
Lines 1422 1431 +9
==========================================
+ Hits 1376 1382 +6
- Misses 46 49 +3
Continue to review full report at Codecov.
|
|
@DDtKey Thank you for your contribution! 🔥 I need a bit more time to review your PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DDtKey Sorry for the long response 🙏
I have left some comments. Could you look at them?
Thanks so much for the comments! |
|
@DDtKey Excellent work! Thank you! ❤️ |
In fact, this refactoring was not as trivial as it seemed 😅
In the end, I came to the conclusion that read a file into memory and a small change in the logic of creating
FileEntrycan be useful (for example, reuse, without re-reading).Files are processed in turn and accordingly there will not be more than one file in RAM.
In any case, we stored all the lines for the 1st file in memory before (
Vec<LineEntry>).But, in a similar way, we can easily count in memory the necessary number of lines and then use them for their intended purpose.
Thanks @evgeniy-r for the idea.
Also, the reading of the lines was made in
FileEntry, because, it seems to me, this is more consistent with the principle of single responsibility, instead of the extensive functions oflib.rsI will be glad to discuss your suggestions and comments!
✔ Checklist: