-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
[IMP] make _set_lines_issue working on empty issue #190
[IMP] make _set_lines_issue working on empty issue #190
Conversation
Hi @legalsylvain thank you for this work. If I understood well, if we call the ocabot migration command in a migration PR that has not been added in the issue before, a new line will be added with the name of the module, right? My suggestion is... Why not adding it by alphabetical order? Is it possible? THX! |
hi. thanks for your review.
|
|
||
# make the addition working on an empty migration issue | ||
if not added: | ||
lines.append(new_line) |
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.
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.
A typical migration issue ends with comments after the check list of modules:
that's not the point of the PR.
The line will be added only if the issue doesn't contain module list.
In your screenshot, my patch has no effect, because previous code will add the line in the correct place, and so added
will be true.
That is just a trivial patch to initialize migration issue, if there is no module list.
I wish we had better tests for _set_lines_issue.
Well. Yes it's possible. The simplier is to change the function _set_lines_issue(gh_pr, issue, module)
by _set_lines_issue(gh_pr_number, gh_pr_login, body_issue, module)``
So simple and precise test can be written, covering all the cases. (without pointing on existing PR as this is the case for the time being https://github.com/OCA/oca-github-bot/blob/master/tests/test_migration_issue_bot.py#L37).
with the current design it is not possible to test the result of the function, because the result is not predictive.
but I have 3 pending PR around _set_lines_issue
so I can do this refactor, but if it's possible, after having merged The current PR.
7e0c185
to
9b5482e
Compare
@sbidoul. I refactored the function to make explicit tests. (coverage: +0,5%) Given a PR '11' made by 'sbidoul' user regarding 'mis_builder' module.
become
become
become
Note : Use case 1 & 2 are the current behaviour. Let me know if it's not clear. |
34dfedb
to
f83caab
Compare
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.
Thanks a lot for the refactoring and test, Sylvain. It's much clearer now :)
Can you also add the news fragment ?
8e7a3ed
to
edba4f6
Compare
e05b3c6
to
4ba3d91
Compare
Yes, they disappear when we run towncrier at release time. |
Thanks ! I thought it was during merge process. |
Hi @legalsylvain Sorry, probably I misunderstood the functionality. Thanks for the quick reply! |
Hi.
when calling
/ocabot migration
, if the issue doesn't contains lines, the command fail silently. (that is due to the github api I guess. If we "edit" an github issue, and write the same text as before, the write is ignored).with that patch, the line is added at the end of the migration issue body.
Context
with the decision to not populate migration issue).
CC : @pedrobaeza, @sbidoul
thanks for your review.