Skip to content
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

Closed
wants to merge 1 commit into from
Closed

[fix] Enforced issue closing #138

wants to merge 1 commit into from

Conversation

devkapilbansal
Copy link
Member

@devkapilbansal devkapilbansal commented Aug 29, 2020

Added an else block to test if long description is present when short description mentions an issue.
Closes #136

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 99.472% when pulling b8222f0 on KapilBansal320:patch-136 into ca385c5 on openwisp:master.

@devkapilbansal devkapilbansal changed the title [fix] Enforced issue closing #136 [fix] Enforced issue closing Aug 29, 2020
@devkapilbansal
Copy link
Member Author

Related to #137

Copy link
Member

@nemesifier nemesifier left a 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

Copy link
Member

@nemesifier nemesifier left a 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:

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.

@devkapilbansal
Copy link
Member Author

@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.

Copy link
Member

@nemesifier nemesifier left a 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:

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

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.

@nemesifier nemesifier closed this Aug 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[QA] Issue closing not being enforced
3 participants