-
Notifications
You must be signed in to change notification settings - Fork 144
Fix item reformat during validation #425
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
The ItemValidator._get_issues_tree() did write completely wrong links back to the item, since the item variable was re-used as a loop variable (now: parent). This bug did not manifest badly since Item.set_links() had no auto_save decorator. Remove the superfluous Item.set_links() and use the setter instead.
|
@sebhub thanks for catching this. This behavior of 1) finding issues and also 2) reformatting the item in the same method was something I wanted to raise later and refactor as a violation of SRP but I also managed to introduce a bug there 😞 I want to provide a test that ensures your change is included in the test harness. I will do it today or tomorrow max. |
ItemValidator: 2 tests for doorstop.settings.REFORMAT == True and == False
|
I think the drop in code coverage due to the patch is harmless. The patch essentially removes a bit of code that was covered 100%. Since the overall coverage is below 100%, removing code with 100% code coverage drops the overall coverage since the ration between covered and uncovered code changes in favour of uncovered code. |
|
I am not sure why you think that the coverage is the same. One of the tests I have written does and I guess, this is what makes CI to be green now. |
|
But it is true that it is not clear, why the coverage in your changeset gets to be a bit less than 95%. |
|
Sorry for the confusion, my comment about the coverage was intended for my patch only and not the new tests. Lets say your code base has 10 lines, 5 lines are covered by tests, then your code coverage is 5 / (5 + 5) = 50%. If you remove one line of code which is covered but superfluous, then your coverage is 4 / (4 + 5) = 44%. I think this is what happened with my patch. |
|
Yes, your explanation makes sense. Thank you. |
The ItemValidator._get_issues_tree() did write completely wrong links
back to the item, since the item variable was re-used as a loop
variable (now: parent). This bug did not manifest badly since
Item.set_links() had no auto_save decorator. Remove the superfluous
Item.set_links() and use the setter instead.