-
-
-
-
rbtools/utils/commands.py (Diff revision 1) Col: 13 E128 continuation line under-indented for visual indent
-
-
rbtools/utils/commands.py (Diff revision 1) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 1) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 1) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 1) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 1) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 1) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 1) Col: 13 E128 continuation line under-indented for visual indent
-
-
-
-
-
-
-
-
-
-
-
-
-
rbtools/utils/tien_template.py (Diff revision 1) Col: 19 E228 missing whitespace around modulo operator
-
-
-
-
rbtools/utils/tien_template.py (Diff revision 1) Col: 33 E228 missing whitespace around modulo operator
-
-
Add commit message template
Review Request #6833 — Created Jan. 27, 2015 and discarded
Information | |
---|---|
tienv | |
RBTools | |
master | |
Reviewers | |
rbtools, students | |
Some RBT commands, like patch/land, allow users to commit with a commit message. Previously, this commit message would be hard coded with python strings, however adding the option to specify a user defined template would be more helpful.
The added option is --template <template_directory_or_name>, which could be any of:
- the template's directory
- the template's directory within the "TEMPLATES_DIR" folder, as specified in .reviewboardrc
- the name of the template, as specified in .reviewboardrcIf no template is specified, a default template is selected.
If no template exists under the argument, the user will be prompted for the default template.
As template design is up to the user, the code is not responsible for handling misconfigured templates.
I've tested with (rbt patch):
--template <existing_template_path>
--template <non_existant_template_path>
--template <existing_template in TEMPLATES_DIR>
--template <variable name in .reviewboardrc>
--template with invalid syntax (like not closing the if statement)
--template attempting to access invalid variables
--commit (no --template, which should render the default template)Unit tests are available as well, but I don't know if they make sense tested that way.
Description | From | Last Updated |
---|---|---|
Col: 1 W293 blank line contains whitespace |
![]() |
|
This doesn't belong in this change. |
|
|
Import statements should go at the beginning of the file. This is grouped in the second group (third-party non-rbtools imports). |
|
|
I know this is a first draft, but perhaps a flag and/or config option would be a better place for … |
|
|
Col: 62 W291 trailing whitespace |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 40 W291 trailing whitespace |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Usually the pattern is except TemplateNotFound as e: Same below. |
|
|
You can remove these lines. No point to keep them commented because they will be in version control. |
|
|
Col: 5 E303 too many blank lines (2) |
![]() |
|
So Jinja2 templates aren't actually python files. This would be better marked as a .txt file because Review Bot is … |
|
|
Col: 2 E225 missing whitespace around operator |
![]() |
|
Col: 42 E225 missing whitespace around operator |
![]() |
|
You are setting variables here but using review_request.bugs_closed later. Why not just use review_request.foo for everything? |
|
|
Col: 2 E225 missing whitespace around operator |
![]() |
|
Col: 50 E225 missing whitespace around operator |
![]() |
|
Col: 2 E225 missing whitespace around operator |
![]() |
|
Col: 52 E225 missing whitespace around operator |
![]() |
|
Col: 2 E225 missing whitespace around operator |
![]() |
|
Col: 44 E225 missing whitespace around operator |
![]() |
|
You don't want two blank lines between summary and description. |
|
|
Col: 2 E225 missing whitespace around operator |
![]() |
|
Col: 11 E225 missing whitespace around operator |
![]() |
|
You don't want two blank lines between description and testing done. You may want to put the blank line after … |
|
|
Col: 2 E225 missing whitespace around operator |
![]() |
|
Col: 19 E228 missing whitespace around modulo operator |
![]() |
|
Col: 1 E112 expected an indented block |
![]() |
|
Col: 2 E225 missing whitespace around operator |
![]() |
|
Col: 11 E225 missing whitespace around operator |
![]() |
|
Col: 33 E228 missing whitespace around modulo operator |
![]() |
|
Col: 2 E225 missing whitespace around operator |
![]() |
|
Col: 1 E112 expected an indented block |
![]() |
|
Again, you probably don't want two blank lines here. |
|
|
'pdb' imported but unused |
![]() |
|
Col: 80 E501 line too long (94 > 79 characters) |
![]() |
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
Col: 1 E302 expected 2 blank lines, found 1 |
![]() |
|
Col: 66 W291 trailing whitespace |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 40 W291 trailing whitespace |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 80 E501 line too long (90 > 79 characters) |
![]() |
|
Col: 1 E302 expected 2 blank lines, found 1 |
![]() |
|
undefined name 'default_templates_dir' |
![]() |
|
Col: 80 E501 line too long (92 > 79 characters) |
![]() |
|
Col: 80 E501 line too long (94 > 79 characters) |
![]() |
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
There's some inconsistency in the blank lines here. If the 'testing done' field is present, there's plenty of space, but … |
|
|
os and pkg_resources are standard library modules, and so should be in their own group before six. six should be … |
|
|
These should be a single import statement and kept alphabetical: from jinja2 import (Environment, FileSystemLoader, StrictUndefined, TemplateError, TemplateNotFound, UndefinedError) |
|
|
Col: 1 E302 expected 2 blank lines, found 1 |
![]() |
|
extract_template is a pretty weird name for this. How about render_commit_message_template? |
|
|
Col: 66 W291 trailing whitespace |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 40 W291 trailing whitespace |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 80 E501 line too long (90 > 79 characters) |
![]() |
|
How about a message more like raise CommandError('Syntax error in template %s: %s' % (template_name, ue.message)) |
|
|
I'd like to see this error message contain the template name, and put it all on one line. Something like … |
|
|
Col: 1 E302 expected 2 blank lines, found 1 |
![]() |
|
This should probably check to make sure that the template name isn't absolute before joining it to cwd/templates |
|
|
undefined name 'default_templates_dir' |
![]() |
|
Col: 80 E501 line too long (92 > 79 characters) |
![]() |
|
Col: 80 E501 line too long (94 > 79 characters) |
![]() |
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
Col: 80 E501 line too long (81 > 79 characters) |
![]() |
|
Col: 80 E501 line too long (99 > 79 characters) |
![]() |
|
Col: 80 E501 line too long (112 > 79 characters) |
![]() |
|
Col: 80 E501 line too long (84 > 79 characters) |
![]() |
|
Col: 80 E501 line too long (87 > 79 characters) |
![]() |
|
Col: 80 E501 line too long (94 > 79 characters) |
![]() |
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
Col: 80 E501 line too long (81 > 79 characters) |
![]() |
|
Col: 29 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 29 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 68 W291 trailing whitespace |
![]() |
|
Col: 37 E127 continuation line over-indented for visual indent |
![]() |
|
Col: 57 W291 trailing whitespace |
![]() |
|
Col: 80 E501 line too long (99 > 79 characters) |
![]() |
|
Col: 100 W291 trailing whitespace |
![]() |
|
Col: 80 E501 line too long (111 > 79 characters) |
![]() |
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
Col: 33 E127 continuation line over-indented for visual indent |
![]() |
|
Col: 33 E127 continuation line over-indented for visual indent |
![]() |
|
Col: 80 E501 line too long (102 > 79 characters) |
![]() |
|
local variable 'e' is assigned to but never used |
![]() |
|
Col: 37 E127 continuation line over-indented for visual indent |
![]() |
|
Col: 80 E501 line too long (82 > 79 characters) |
![]() |
|
Col: 33 E127 continuation line over-indented for visual indent |
![]() |
|
Col: 80 E501 line too long (83 > 79 characters) |
![]() |
|
Col: 42 W291 trailing whitespace |
![]() |
|
local variable 'e' is assigned to but never used |
![]() |
|
Col: 80 E501 line too long (84 > 79 characters) |
![]() |
|
self.config.get(name) should be the equivalent of the self.config[name] if condition else None |
VT VTL-Developer | |
Col: 80 E501 line too long (98 > 79 characters) |
![]() |
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
Col: 31 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 33 E127 continuation line over-indented for visual indent |
![]() |
|
I noticed you have three cases. For the case where there's only template_name, it get combines with working directory and … |
VT VTL-Developer | |
Col: 59 W291 trailing whitespace |
![]() |
|
Col: 80 E501 line too long (89 > 79 characters) |
![]() |
|
Col: 71 W291 trailing whitespace |
![]() |
|
Add a real help description. |
|
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
One blank line instead of two. |
|
|
Add a blank line between these two. |
|
|
Undo this change. |
|
|
We only use trailing commas on the last line of a dictionary definition. |
|
|
Move this up to the previous line. |
|
|
Use e instead of tnfe. This is for consistency with the rest of the codebase. |
|
|
Use e instead of ue. |
|
|
Use e instead of te. |
|
|
We don't use str.format. Please use % instead for string formatting. |
|
|
More than one of these can fit on a line. |
|
|
Blank line between a statement and a block |
|
|
We don't use str.format. Please use % for formatting instead. |
|
|
This string isn't formatted correctly. There will be no space between file and must. Also, please use all available line … |
|
|
Since you are doing the following: else: if foo: bar() else: baz() This can be changed to: elif foo: bar() … |
|
|
Isn't this the template filename, not the directory? |
|
|
One blank line between these. |
|
|
Why unset the name here? |
|
|
Use %s instead for string formatting. |
|
|
More than one of these can fit on a line. |
|
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
'Template' imported but unused |
![]() |
|
Col: 80 E501 line too long (89 > 79 characters) |
![]() |
|
Col: 80 E501 line too long (83 > 79 characters) |
![]() |
|
Col: 80 E501 line too long (80 > 79 characters) |
![]() |
|
Col: 1 W293 blank line contains whitespace |
![]() |
|
undefined name 'ue' |
![]() |
|
Please revert this change. |
|
|
Please revert this change. |
|
|
This is part of a separate review request and should not be present in this change. |
|
|
How about just doing import jinja2 and then using qualified names (jinja2.Environment) for each of these? Many of these names … |
|
|
This should be a fully-qualified module name (rbtools.utils.console) |
|
|
This method should have a docstring. |
|
|
Based on this code, it looks like directory is actually a filename, not a directory. |
|
|
Comments should have proper capitalization and punctuation. |
|
|
We generally don't use try/else. Instead, you can move template.render() into the try case above and then have all the … |
|
|
Is this the best name for this method? Probably not. |
|
|
This doesn't look like it's returning the directory name (rather, it looks like it's returning a filename). The explanation of … |
|
|
This function isn't terribly well named anymore. Can we change it to be build_commit_message? |
|
|
'extract_commit_message' imported but unused |
![]() |
|
undefined name 'build_commit_message' |
![]() |
|
'extract_commit_message' imported but unused |
![]() |
|
undefined name 'build_commit_message' |
![]() |
|
Please revert this change. |
|
|
Revert this change. |
|
|
I'm not sure why you set these variables, given that later on you use review_request.bugs_closed. Can we just prefix all … |
|
|
Should have a space before the closing %} |
|
|
Should have a space before the closing %} |
|
|
This should be a docstring, not a comment (and change 'Returns' to 'Return' and add a period at the end.) |
|
|
Returns -> Return. |
|
|
What is 'template_cmnd'? That string doesn't appear anywhere else in this change. |
|
|
This should present an error that the commit message template directory could not be found. |
|
|
Please add a class docstring. |
|
|
Indent this 4 more spaces. |
|
|
Please add docstrings for all the test methods in here. We want to print nice things with nosetests -v |
|
|
Alphabetize these. |
|
|
I would reword this to say something like "Use the specified template (either in the directory specified in .reviewboardrc or … |
|
|
We use single quotes for strings. |
|
|
This should be on the previous line. |
|
|
Since we're using this in multiple places, this might be worth putting into a list in __init__.py and referencing it … |
|
|
See my other comment. |
|
|
We use single quotes for strings. |
|
|
This should be on the previous line. |
|
|
Use single quotes for all these strings. |
|
|
Can you put the first %s in double quotes? |
|
|
Use a %-formatting expression. Its more efficient than string concatenation. |
|
|
Can you format that is as a reStructured Text List and mark the keys with double backticks, e.g. * ``foo``: … |
|
|
Can we rename template_cmd to something like template_arg or specified_template? template_cmd seems like an inaccurate name for it. |
|
|
Maybe this should this just be template ? |
|
|
Blank line between these. |
|
|
Put this on the previous line. |
|
|
Use a %-formatting expression here. |
|
|
Blank line between these. |
|
|
Blank line between these. |
|
|
Blank line between these. |
|
|
Alphabetize these. |
|
|
Col: 80 E501 line too long (81 > 79 characters) |
![]() |
|
Can you format the docstring as such: def render_template(filename, review_request): """Render a commit message template. It is up to the … |
|
|
This should be a docstring, not a comment. |
|
|
Col: 80 E501 line too long (81 > 79 characters) |
![]() |
|
No blank line between the docstring and code for methods. |
|
|
All test docstrings should start with "Testing" instead of "Test". Here and below. |
|
|
First line of a docstring should come right after """ ("""Render a template...) |
|
|
This should just be """Return the filename of the default template.""" (note: one line, with period) |
|
|
Instead of defining a new empty class for this, I think you could just do mock_review_request = object() |
|
|
alphabetical order |
VT VTL-Developer | |
If .reviewboardrc specifies a template, it should be used for all commits, without needing to pass an argument. |
|
|
This isn't needed. |
|
|
The wrapping should use up more of the line. |
|
|
Same comments here. |
|
|
This should be part of the next group of imports. |
|
|
This should use format strings, instead of string concatenation. |
|
|
Blank line between these. |
|
|
This is deprecated. You'll need to rewrite the code to use os.walk instead. |
|
|
Looks like trim_blocks will easily fit on the previous line. |
|
|
I don't know that a newline is appropriate here. Can it just be: 'Template error: %s' ? |
|
|
You can use os.path.abspath(template_arg) instead, and it will do the equivalent. |
|
|
This leaves out the space between sentences. |
|
|
This code is repeating itself. You should rewrite it to only do this once. |
|
|
Same here. |
|
|
Missing a trailing period. |
|
|
Missing a trailing period. |
|
|
Must be in alphabetical order. |
|
|
You shouldn't really use """ here. Instead, it's best to just do: mock_template = ( 'Start\n' '...\n' '...\n') That way, … |
|
|
These really should go in the tests themselves, so that they're self-contained and not vulnerable to impact from another test … |
|
|
This should be done in setUp(). |
|
|
I missed this part of the design before. I realize now that this is allowing multiple templates per tree. I've … |
|
|
No backticks here. It'll actually render incorrectly, as comments are meant to be in ReST syntax, where backticks are used … |
|
|
Might be nice to have a bit of information on the format of the template here. Things like how variables/functions … |
|
|
You should be able to use os.path.split here, to do this in one go. |
|
|
Missing a trailing period. |
|
|
Should use single quotes where possible. |
|
|
"Error" shouldn't be capitalized. |
|
|
We may want to check that this is a directory first, and provide an error otherwise. |
|
|
This should just be: if not default_templates: Better than checking < 1, since the only reasonable value is 0. |
|
|
Blank line here. |
|
|
I kind of think that if the template is missing, we should just error out. That's a very clear configuration … |
|
|
Missing a trailing period. "Raises" is maybe the wrong word here? |
|
|
'build_commit_message' imported but unused |
![]() |
|
Col: 69 W291 trailing whitespace |
![]() |
|
undefined name 'extract_commit_message' |
![]() |
|
'build_commit_message' imported but unused |
![]() |
|
Col: 69 W291 trailing whitespace |
![]() |
|
undefined name 'extract_commit_message' |
![]() |

-
-
-
rbtools/utils/commands.py (Diff revision 1) Import statements should go at the beginning of the file. This is grouped in the second group (third-party non-rbtools imports).
-
rbtools/utils/commands.py (Diff revision 1) I know this is a first draft, but perhaps a flag and/or config option would be a better place for this. Something like
TEMPLATE_ENV = 'templates' POST_TEMLATE = 'post.txt'
with some reasonable defaults. Or it could be passed in as a parameter to the function. I'm not sure about this.
-
rbtools/utils/commands.py (Diff revision 1) Usually the pattern is
except TemplateNotFound as e:
Same below.
-
rbtools/utils/commands.py (Diff revision 1) You can remove these lines. No point to keep them commented because they will be in version control.
-
rbtools/utils/tien_template.py (Diff revision 1) So Jinja2 templates aren't actually python files. This would be better marked as a
.txt
file because Review Bot is going to keep having issues with it. -
rbtools/utils/tien_template.py (Diff revision 1) You are setting variables here but using
review_request.bugs_closed
later. Why not just usereview_request.foo
for everything? -
rbtools/utils/tien_template.py (Diff revision 1) You don't want two blank lines between summary and description.
-
rbtools/utils/tien_template.py (Diff revision 1) You don't want two blank lines between description and testing done.
You may want to put the blank line after the
{% if testing_done %}
bit.
-
rbtools/utils/tien_template.py (Diff revision 1) Again, you probably don't want two blank lines here.
Branch: |
|
||||
---|---|---|---|---|---|
Commit: |
|
||||
Diff: |
Revision 2 (+81 -21) |

-
Tool: Pyflakes Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
-
-
rbtools/utils/commands.py (Diff revision 2) Col: 13 E128 continuation line under-indented for visual indent
-
-
rbtools/utils/commands.py (Diff revision 2) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 2) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 2) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 2) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 2) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 2) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 2) Col: 13 E128 continuation line under-indented for visual indent
-
-
-
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+78 -21) |

-
Tool: Pyflakes Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
-
rbtools/utils/commands.py (Diff revision 3) Col: 13 E128 continuation line under-indented for visual indent
-
-
rbtools/utils/commands.py (Diff revision 3) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 3) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 3) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 3) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 3) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 3) Col: 13 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 3) Col: 13 E128 continuation line under-indented for visual indent
-
-
-
-
-
-
rbtools/templates/default.txt (Diff revision 3) There's some inconsistency in the blank lines here. If the 'testing done' field is present, there's plenty of space, but if it's not, the bugs and review request URL will be jammed up right against the description.
We should also have a blank line after the summary.
-
rbtools/utils/commands.py (Diff revision 3) os and pkg_resources are standard library modules, and so should be in their own group before
six
.six
should be grouped with the jinja2 imports. -
rbtools/utils/commands.py (Diff revision 3) These should be a single import statement and kept alphabetical:
from jinja2 import (Environment, FileSystemLoader, StrictUndefined, TemplateError, TemplateNotFound, UndefinedError)
-
rbtools/utils/commands.py (Diff revision 3) extract_template
is a pretty weird name for this. How aboutrender_commit_message_template
? -
rbtools/utils/commands.py (Diff revision 3) How about a message more like
raise CommandError('Syntax error in template %s: %s' % (template_name, ue.message))
-
rbtools/utils/commands.py (Diff revision 3) I'd like to see this error message contain the template name, and put it all on one line. Something like this:
raise CommandError('Unknown error while rendering commit-message template %s: %s' % (template_name, e.message))
-
rbtools/utils/commands.py (Diff revision 3) This should probably check to make sure that the template name isn't absolute before joining it to cwd/templates
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+80 -20) |

-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt Tool: Pyflakes Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
-
-
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+89 -24) |

-
Tool: Pyflakes Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
rbtools/utils/commands.py (Diff revision 5) Col: 29 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 5) Col: 29 E128 continuation line under-indented for visual indent
-
-
rbtools/utils/commands.py (Diff revision 5) Col: 37 E127 continuation line over-indented for visual indent
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 6 (+110 -24) |

-
Tool: Pyflakes Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
-
-
rbtools/utils/commands.py (Diff revision 6) Col: 33 E127 continuation line over-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 6) Col: 33 E127 continuation line over-indented for visual indent
-
-
-
rbtools/utils/commands.py (Diff revision 6) Col: 37 E127 continuation line over-indented for visual indent
-
-
rbtools/utils/commands.py (Diff revision 6) Col: 33 E127 continuation line over-indented for visual indent
-
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 7 (+118 -24) |

-
Tool: Pyflakes Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 8 (+122 -24) |

-
Tool: Pyflakes Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
rbtools/utils/commands.py (Diff revision 8) Col: 31 E128 continuation line under-indented for visual indent
-
rbtools/utils/commands.py (Diff revision 8) Col: 33 E127 continuation line over-indented for visual indent
-
-
-
-
-
rbtools/commands/patch.py (Diff revision 8) self.config.get(name)
should be the equivalent of theself.config[name] if condition else None
-
-
rbtools/utils/commands.py (Diff revision 8) I noticed you have three cases. For the case where there's only template_name, it get combines with working directory and template_name becomes empty. For the case where there's a template_dir, it gets added to working directory, and the template_name can or can not be empty. It seems a bit inconsistent. Not familiar with the templating, so I don't know if it accomodates for that, but my view I feel it may cause errors.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 9 (+119 -24) |

-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt Tool: Pyflakes Processed Files: rbtools/commands/patch.py rbtools/commands/post.py rbtools/utils/commands.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
-
-
-
rbtools/utils/commands.py (Diff revision 9) We only use trailing commas on the last line of a dictionary definition.
-
-
rbtools/utils/commands.py (Diff revision 9) Use
e
instead oftnfe
. This is for consistency with the rest of the codebase. -
-
-
rbtools/utils/commands.py (Diff revision 9) We don't use
str.format
. Please use%
instead for string formatting. -
-
-
rbtools/utils/commands.py (Diff revision 9) We don't use
str.format
. Please use%
for formatting instead. -
rbtools/utils/commands.py (Diff revision 9) This string isn't formatted correctly. There will be no space between
file
andmust
. Also, please use all available line width efficiently. -
rbtools/utils/commands.py (Diff revision 9) Since you are doing the following:
else: if foo: bar() else: baz()
This can be changed to:
elif foo: bar() else: baz()
This reduces the nesting and makes the code easier to follow.
-
-
-
-
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 10 (+135 -25) |

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 11 (+135 -25) |

-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
Summary: |
|
|||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||||||||
Testing Done: |
|
|||||||||||||||||||||||||||||||||
Commit: |
|
|||||||||||||||||||||||||||||||||
Diff: |
Revision 12 (+239 -24) |

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
rbtools/commands/post.py (Diff revision 12) This is part of a separate review request and should not be present in this change.
-
rbtools/utils/commands.py (Diff revision 12) How about just doing
import jinja2
and then using qualified names (jinja2.Environment
) for each of these? Many of these names are pretty generic, and when looking at names likeEnvironment
andUndefinedError
it's not immediately apparent that these are part of jinja2. -
rbtools/utils/commands.py (Diff revision 12) This should be a fully-qualified module name (
rbtools.utils.console
) -
-
rbtools/utils/commands.py (Diff revision 12) Based on this code, it looks like
directory
is actually a filename, not a directory. -
rbtools/utils/commands.py (Diff revision 12) Comments should have proper capitalization and punctuation.
-
rbtools/utils/commands.py (Diff revision 12) We generally don't use try/else. Instead, you can move
template.render()
into the try case above and then have all the exception handlers at one level:try: env = Environment(...) template = env.get_template(template_name) return template.render(review_request=review_request) except TemplateNotFound as e: ... except UndefinedError as e: ... ...
-
-
rbtools/utils/commands.py (Diff revision 12) This doesn't look like it's returning the directory name (rather, it looks like it's returning a filename).
The explanation of what this method does should also be a docstring instead of a comment.
-
rbtools/utils/commands.py (Diff revision 12) This function isn't terribly well named anymore. Can we change it to be
build_commit_message
?
Change Summary:
Changed mostly formatting issues based on David's code reviews.
I am pretty sure this works, what do I have to do next to land this?
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 13 (+233 -24) |

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 14 (+235 -26) |

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/commands/post.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
-
-
rbtools/templates/default.txt (Diff revision 14) I'm not sure why you set these variables, given that later on you use
review_request.bugs_closed
. Can we just prefix all variables withreview_request.
? -
-
-
rbtools/utils/commands.py (Diff revision 14) This should be a docstring, not a comment (and change 'Returns' to 'Return' and add a period at the end.)
-
-
rbtools/utils/commands.py (Diff revision 14) What is 'template_cmnd'? That string doesn't appear anywhere else in this change.
-
rbtools/utils/commands.py (Diff revision 14) This should present an error that the commit message template directory could not be found.
-
-
-
rbtools/utils/tests.py (Diff revision 14) Please add docstrings for all the test methods in here. We want to print nice things with
nosetests -v
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 15 (+246 -26) |

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
-
rbtools/commands/land.py (Diff revision 15) I would reword this to say something like
"Use the specified template (either in the directory specified in .reviewboardrc or by its path) to generate the commit message."
Also, I would put the space on the previous line because it reads more nicely.
-
-
-
rbtools/commands/patch.py (Diff revision 15) Since we're using this in multiple places, this might be worth putting into a list in
__init__.py
and referencing it elsewhere (so that we're not repeating ourselves). -
-
-
-
-
-
rbtools/utils/commands.py (Diff revision 15) Use a
%
-formatting expression. Its more efficient than string concatenation. -
rbtools/utils/commands.py (Diff revision 15) Can you format that is as a reStructured Text List and mark the keys with double backticks, e.g.
* ``foo``: bar * ``bar``: baz
-
rbtools/utils/commands.py (Diff revision 15) Can we rename
template_cmd
to something liketemplate_arg
orspecified_template
?template_cmd
seems like an inaccurate name for it. -
-
-
-
-
-
-
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 16 (+250 -27) |

-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 17 (+250 -27) |

-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
Just some style nits:
-
rbtools/utils/commands.py (Diff revision 17) Can you format the docstring as such:
def render_template(filename, review_request): """Render a commit message template. It is up to the template author to ensure that the syntax is correct. If not, this method will raise an error with Jinja2's error message. """
Specifically, the changes are:
- First line should be a short summary.
- Blank line between summary and more extensive description.
- Imperative mood in the summary ("Render" rather than "Renders").
- Periods at the end of sentences. -
-
rbtools/utils/commands.py (Diff revision 17) No blank line between the docstring and code for methods.
-
rbtools/utils/tests.py (Diff revision 17) All test docstrings should start with "Testing" instead of "Test". Here and below.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 18 (+248 -23) |

-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt

-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
rbtools/utils/commands.py (Diff revision 19) First line of a docstring should come right after """ (
"""Render a template...
) -
rbtools/utils/commands.py (Diff revision 19) This should just be
"""Return the filename of the default template."""
(note: one line, with period) -
rbtools/utils/tests.py (Diff revision 19) Instead of defining a new empty class for this, I think you could just do
mock_review_request = object()
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 20 (+249 -27) |

-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 21 (+249 -27) |

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
rbtools/commands/land.py (Diff revision 21) If
.reviewboardrc
specifies a template, it should be used for all commits, without needing to pass an argument. -
-
-
-
-
rbtools/utils/commands.py (Diff revision 21) This should use format strings, instead of string concatenation.
-
-
rbtools/utils/commands.py (Diff revision 21) This is deprecated. You'll need to rewrite the code to use
os.walk
instead. -
rbtools/utils/commands.py (Diff revision 21) Looks like
trim_blocks
will easily fit on the previous line. -
rbtools/utils/commands.py (Diff revision 21) I don't know that a newline is appropriate here. Can it just be:
'Template error: %s'
? -
rbtools/utils/commands.py (Diff revision 21) You can use
os.path.abspath(template_arg)
instead, and it will do the equivalent. -
-
rbtools/utils/commands.py (Diff revision 21) This code is repeating itself. You should rewrite it to only do this once.
-
-
-
-
-
rbtools/utils/tests.py (Diff revision 21) You shouldn't really use
"""
here. Instead, it's best to just do:mock_template = ( 'Start\n' '...\n' '...\n')
That way, we better control newline characters and indentation, producing more reliable test results.
Same with all others.
-
rbtools/utils/tests.py (Diff revision 21) These really should go in the tests themselves, so that they're self-contained and not vulnerable to impact from another test wanting to modify a string slightly.
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 22 (+230 -27) |

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
rbtools/commands/land.py (Diff revision 22) I missed this part of the design before. I realize now that this is allowing multiple templates per tree. I've discussed this with others, and I think it's probably best to keep this simple and just have a single template specified in
.reviewboardc
.I think we should focus on one template, and don't provide an option to override.
The reason is that a project is going to have a standard, and they want all commits to meet that standard. If something more custom is needed, it can just be a manually-created/augmented commit, but I don't think there are any cases where people are going to need multiple templates here.
What use-cases did you have in mind?
-
rbtools/utils/commands.py (Diff revision 22) No backticks here. It'll actually render incorrectly, as comments are meant to be in ReST syntax, where backticks are used for document references.
-
rbtools/utils/commands.py (Diff revision 22) Might be nice to have a bit of information on the format of the template here. Things like how variables/functions are used.
-
rbtools/utils/commands.py (Diff revision 22) You should be able to use
os.path.split
here, to do this in one go. -
-
-
-
rbtools/utils/commands.py (Diff revision 22) We may want to check that this is a directory first, and provide an error otherwise.
-
rbtools/utils/commands.py (Diff revision 22) This should just be:
if not default_templates:
Better than checking
< 1
, since the only reasonable value is 0. -
-
rbtools/utils/commands.py (Diff revision 22) I kind of think that if the template is missing, we should just error out. That's a very clear configuration problem.
-
rbtools/utils/commands.py (Diff revision 22) Missing a trailing period.
"Raises" is maybe the wrong word here?
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 23 (+248 -27) |

-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
-

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt
-
-
-

-
Tool: Pyflakes Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py rbtools/utils/commands.py rbtools/utils/tests.py rbtools/commands/patch.py Ignored Files: rbtools/templates/default.txt