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

[QA] Issue closing not being enforced #136

Closed
nemesifier opened this issue Aug 29, 2020 · 3 comments
Closed

[QA] Issue closing not being enforced #136

nemesifier opened this issue Aug 29, 2020 · 3 comments
Labels

Comments

@nemesifier
Copy link
Member

nemesifier commented Aug 29, 2020

The check performed at these lines is not being executed:

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>"'
)

@nemesifier
Copy link
Member Author

Confirmed with this test: #137
The QA check should have rejected the commit message.

@devkapilbansal
Copy link
Member

@nemesisdesign the check you mentioned only executes when there is a long_desc present.
For this we have to test if short_description mentions an issue when long_description is not present. I have made a pull request #138 with necessary changes.

if long_desc:
if len(lines) > 1 and lines[1] != '':
errors.append(
'please ensure there is a blank line between '
'the commit short and long description'
)
message = ' '.join(long_desc)
result = _find_issue_mentions(message)
issues = result['issues']
good_mentions = result['good_mentions']
# check issue mentions in long desc
issue_location = re.search(r'\#(\d+)', message)
if issue_location:
if good_mentions != len(issues):
errors.append(
'You are mentioning an issue in the long description '
'without closing it: is it intentional?\n '
'If not, please use "Closes #<issue>" or "Fixes #<issue>"\n '
'Otherwise, use "Related to #<issue>'
)
shot_desc_mentions = 0
for issue in issues:
if re.search(r'\{}'.format(issue), short_desc):
shot_desc_mentions += 1
if shot_desc_mentions < 1:
errors.append(
'if you mention an issue in the long description, '
'please show it in the short description too\n '
'eg: [prefix] Action performed #234\n\n '
'Long desc. Closes #234'
)
# if short description mentions an issue
# ensure the issue is either closed or mentioned as "related"
if re.search(r'\#(\d+)', short_desc):
mentions = 0
for issue in issues:
if re.search(r'\{}'.format(issue), short_desc):
mentions += 1
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 '

@nemesifier
Copy link
Member Author

@nemesisdesign the check you mentioned only executes when there is a long_desc present.
For this we have to test if short_description mentions an issue when long_description is not present. I have made a pull request #138 with necessary changes.

You're right, I linked the wrong piece of code, I updated the issue description and also replied to your PR with more info, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants