Add status-update command to rbtools.
Review Request #9343 — Created Nov. 1, 2017 and submitted
Review Board 3.0 introduced new support for "status updates" which are
used to indicate if a review request is undergoing some automated checks
of some kind (for instance, automated code review or pending builds).
These can have a state (such as "pending", "error", "success", and
others), a summary, optional link, and a review (when there are errors).This adds a new command for working with status updates, helping to
create/update the state of a status update. This command can be run with
rbt status-update
.
Debug testing of the
--review
input on local installation with the following file contents:{ "review": { "body_top": "Header comment" }, "diff_comment": [ { "filediff_id": 10, "first_line": 729, "issue_opened": true, "num_lines": 1, "text": "Adding a comment on a diff line", "text_type": "markdown" } ], "general_comments": [ { "text": "Adding a general comment", "text_type": "markdown" } ] }
Description | From | Last Updated |
---|---|---|
Missing docs rst file for new status-update command. |
bleblan2 | |
You might want to pull out each action into its own function. |
brennie | |
I know most files in rbtools don't have them (yet), but we should have a file docstring at the top. |
david | |
Add a blank line between these two. |
david | |
Needs "Args" and "Returns" sections. |
david | |
We don't need to define a variable if we're immediately returning it. It would also be a bit nicer to … |
david | |
Needs an "Args" section. |
david | |
Needs "Args" and "Returns" sections. |
david | |
Needs "Args" and "Raises" sections. |
david | |
Needs "Args" and "Raises" sections. |
david | |
It's kind of confusing how this can either be an individual status update or the list of all status updates. … |
david | |
Needs "Args" and "Raises" sections. |
david | |
Needs "Args" and "Raises" sections. |
david | |
In addition to specifying the details like this, perhaps we can show an example JSON blob? |
david | |
paren can go on the previous line. |
david | |
Instead of using the continuation character, let's wrap the whole thing in parens: if (not file_contents.get('reviews') and not file_contents.get('diff_comments') and … |
david | |
get -> hasattr |
david | |
get -> hasattr |
david | |
get -> hasattr |
david | |
Needs a period. |
david | |
Needs "Args" and "Raises" sections. |
david | |
Needs a period. |
david | |
I'm guessing you haven't yet tested this functionality because you'll need to associate the newly created review ID with the … |
david | |
mode is also unicode |
david | |
mode is also unicode, but we shouldn't need to have it as an arg at all because we'll always be … |
david | |
You can avoid having the entire get_file function by doing: return json.load(open(path, 'r')) We shouldn't need expandvars or expanduser because … |
david | |
F841 local variable 'required_fields' is assigned to but never used |
reviewbot |
-
-
rbtools/commands/status_update.py (Diff revision 1) You might want to pull out each action into its own function.
Change Summary:
Move each action into their own functions.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+256) |
Checks run (2 succeeded)
Change Summary:
Add current dev changes.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+291) |
Checks run (2 succeeded)
Change Summary:
Fix valid state options.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+291) |
Checks run (2 succeeded)
Change Summary:
Add basic review creation functionality.
Testing Done: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 5 (+361) |
Checks run (2 succeeded)
-
-
rbtools/commands/status_update.py (Diff revision 5) I know most files in rbtools don't have them (yet), but we should have a file docstring at the top.
-
-
-
rbtools/commands/status_update.py (Diff revision 5) We don't need to define a variable if we're immediately returning it. It would also be a bit nicer to wrap this as:
return { key: status_update.get(key) for key in keys if status_update.get(key) }
-
-
-
-
-
rbtools/commands/status_update.py (Diff revision 5) It's kind of confusing how this can either be an individual status update or the list of all status updates. I think I'd prefer if the conditional (do we have
self.options.sid
) is the top-level construct and then we either update or create as appropriate. -
-
-
rbtools/commands/status_update.py (Diff revision 5) In addition to specifying the details like this, perhaps we can show an example JSON blob?
-
-
rbtools/commands/status_update.py (Diff revision 5) Instead of using the continuation character, let's wrap the whole thing in parens:
if (not file_contents.get('reviews') and not file_contents.get('diff_comments') and not file_contents.get('general_comments')):
You can also use
hasattr
instead ofget
, which is a bit more efficient. -
-
-
-
-
-
-
rbtools/commands/status_update.py (Diff revision 5) I'm guessing you haven't yet tested this functionality because you'll need to associate the newly created review ID with the status update.
It's also a good idea to do that association before publishing the review, so it doesn't show up (momentarily) as a regular review.
-
-
rbtools/utils/filesystem.py (Diff revision 5) mode
is alsounicode
, but we shouldn't need to have it as an arg at all because we'll always be reading the file. We can just pass in'r'
toopen
. -
rbtools/utils/filesystem.py (Diff revision 5) You can avoid having the entire
get_file
function by doing:return json.load(open(path, 'r'))
We shouldn't need
expandvars
orexpanduser
because the user's shell should have done the globbing for us.
Change Summary:
Update review request based on feedback and clean stuff up.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 6 (+441) |
Checks run (2 succeeded)
Change Summary:
Add attaching of created review to status-update and move out of WIP.
Summary: |
|
||||
---|---|---|---|---|---|
Commit: |
|
||||
Diff: |
Revision 7 (+469) |
Checks run (2 succeeded)
Change Summary:
Add docs rst file for status-update and add APIError catching to review creation.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 8 (+538) |
Checks run (1 failed, 1 succeeded)
flake8
-
rbtools/commands/status_update.py (Diff revision 8) F841 local variable 'required_fields' is assigned to but never used
Change Summary:
Fix flake8 error.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 9 (+536) |