-
Notifications
You must be signed in to change notification settings - Fork 73
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
[fix] Enforced issue closing #138
Conversation
Related to #137 |
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.
I don't think it's necessary to add new code.
There's already a piece of code that used to do this check, then at some point recently it has stopped to work.
In these cases, the procedure to follow is:
- go back in time in the repo (eg:
git reset --hard HEAD~50
) and test the commit check until it works as it should - then, go forward in the history until it is found which commit broke the behavior
- once the commit which broke the feature is found, we should analyze it to understand why it broke the feature and why the tests are not catching this problem
- then we have to update the tests so there's at least one failure
- then we have to patch the code to make sure the test fails
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.
@KapilBansal320 I realized the code linked in the issue is mistaken, this is the piece of code which is not doing its job now:
openwisp-utils/openwisp_utils/qa.py
Lines 155 to 163 in fc28a78
if mentions < 1: | |
errors.append( | |
'You are mentioning an issue in the short description ' | |
'but it is not clear whether the issue is resolved or not;\n ' | |
'if it is resolved, please add to the commit long description:\n ' | |
'"Closes #<issue-number>" or "Fixes #<issue-number>";\n ' | |
'if the issue is not resolved yet, please use the following form:\n ' | |
'"Related to #<issue-number>"' | |
) |
I updated the issue as well.
@nemesisdesign going back in time doesn't help. May be this issue was not known till now. Also,I had made changes according to latest file from master, not from the file you linked previously. |
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.
@nemesisdesign going back in time doesn't help. May be this issue was not known till now. Also,I had made changes according to latest file from master, not from the file you linked previously.
I found it!
You're partly right.
It's always been this way, that code I linked does work but it's only triggered with a commit message like:
[test] Testing issue #136
Test
A commit message which doesn't have the long description (the text after the blank line) won't trigger any error, but it should.
So, this commit message now passes, but it's wrong, it shouldn't:
[test] Testing issue #136
Most likely the contributor is forgetting to close the issue, this causes issues to remain open which then have to be closed manually during inspection, which equals a waste of time for maintainers.
I thin the culprit is the fact that this check:
openwisp-utils/openwisp_utils/qa.py
Lines 155 to 163 in fc28a78
if mentions < 1: | |
errors.append( | |
'You are mentioning an issue in the short description ' | |
'but it is not clear whether the issue is resolved or not;\n ' | |
'if it is resolved, please add to the commit long description:\n ' | |
'"Closes #<issue-number>" or "Fixes #<issue-number>";\n ' | |
'if the issue is not resolved yet, please use the following form:\n ' | |
'"Related to #<issue-number>"' | |
) |
Is done only if long_desc
is present
openwisp-utils/openwisp_utils/qa.py
Line 117 in fc28a78
if long_desc: |
It should be instead always done.
Since I've done the debugging and the fix takes really nothing, I already sent a fix in #139.
I hope that this has been nonetheless instructive for you if you want to work on similar issues.
Added an else block to test if long description is present when short description mentions an issue.
Closes #136