- Change Summary:
-
Enforced pep8 compliance and hid the unused views appropriately.
- Description:
-
~ Created a new script for generating scaffolding for new extensions.
~ Created a new script for generating scaffolding for new extensions.
- Added option to create a dashboard stub. - Added option to set configurability and create configuration page. - Diff:
-
Revision 2 (+333 -1)
Created a new script for generating scaffolding for new extensions.
Review Request #2822 — Created Jan. 23, 2012 and discarded
Created a new script for generating scaffolding for new extensions.
I added some unit tests for naming convention testing and conversion, but otherwise all testing has been manual on Linux 3.1.8-1. I have tried creating new extensions with each option, and installing the egg using easy_install name develop on a local environment.
Description | From | Last Updated |
---|---|---|
The convention is to have imports in alphabetical order. |
ME medanat | |
this could be: return response[0].lower() == 'y' |
ME medanat | |
This could be: return bool(re.match(self.REGEX, string)) |
ME medanat | |
You can use the bool() function here again. |
ME medanat | |
This could be: return re.match(r'^[a-z]', string) != None |
ME medanat | |
This may not be very readable. Consider breaking it into multiple lines. |
ME medanat | |
This could be: if string: Since None and the empty string have the same boolean value of False in Python. |
ME medanat | |
This could be: (I'm not 100% sure on this one) if not options.description: |
ME medanat | |
Leave a space between imports and code body. |
ME medanat | |
Again, if dashboard_link Also, why are you prefixing the tags with hyphens? |
ME medanat | |
Again, if dashboard_link |
ME medanat | |
This would be: URLHook(extension, pattern) |
ME medanat | |
Same init issue: Class(arg1, ...) |
ME medanat | |
init issue again. |
ME medanat | |
I'm not sure what's going on here with the template tags: {{'{%'}} Is there a reason you're doing it this … |
ME medanat | |
Place this in a trans block. |
ME medanat | |
Place "To do..." in trans block. |
ME medanat | |
These could be on the same line. Also, it seems that there's an extra single space before "To do..." "To … |
ME medanat | |
Not sure if this applies in template pages, but this could be: {% if dashboard_link %} |
ME medanat | |
Consider adding the an all caps case? |
ME medanat | |
Isn't the comma at the end of this string a syntax error? |
ME medanat | |
We'll want some documentation for this function, and the various classes / functions below. |
mike_conley | |
I wonder if it'd be clearer if the flow for the unrecognized input case was as follows: 1) Ask the … |
mike_conley | |
Possibly place this variable within __init__ |
ME medanat | |
Same thing, place within __init__ |
ME medanat | |
Same thing, place within __init__ |
ME medanat | |
--dashboard-link is optional - we should mention that in its help information. |
mike_conley | |
Newlines above and below this for block. |
mike_conley | |
This template is missing from your patch. |
mike_conley | |
Nitpicking here: {%- if dashboard_link is not none%} Add a single space after none |
ME medanat | |
All this could be wrapped within the same: {%- if dashboard_link is not none %} {%- endif %} |
ME medanat | |
Wrap within same if statement. |
ME medanat | |
jinja2 is a third-party module, and belongs in a group after the built-in Python modules. |
chipx86 | |
Same. |
chipx86 | |
Two blank lines here. |
chipx86 | |
No need for the parens around question. |
chipx86 | |
No need for the len() check, I don't think. |
chipx86 | |
Blank line between these. |
chipx86 | |
Classes should always at least inherit from 'object'): class NamingConvention(object): |
chipx86 | |
Should use re.compile(). |
chipx86 | |
The regex should be pulled out into a compiled regex in the class. |
chipx86 | |
This can be one statement. |
chipx86 | |
Make this part of the class, and compile it. |
chipx86 | |
One statement. |
chipx86 | |
This can be simplified to: if string: string = ... elif case.formatted(string): return |
chipx86 | |
Blank line between these. |
chipx86 | |
Blank line between these. |
chipx86 | |
Blank line between these. Basically: Blank line before/after a block of code. |
chipx86 | |
Inherit from object. |
chipx86 | |
Should use the os.path stuff to parse the path. |
chipx86 | |
Use os.path.join instead. |
chipx86 | |
No need for parens when it's just one thing in the format arguments. |
chipx86 | |
Blank line. |
chipx86 | |
Use 'f', not 'FILE'. No uppercase unless it's a constant. |
chipx86 | |
Blank line. |
chipx86 | |
Blank line. |
chipx86 | |
Blank line. |
chipx86 | |
Two blank lines. |
chipx86 | |
Should use Django's url() stuff. |
chipx86 | |
Two blank lines. |
chipx86 | |
__init__ should take *args, **kwargs, and the super() should pass it. That allows us to expand down the road without … |
chipx86 | |
The URLs should be indented only 4 spaces, and use the url() stuff. Also, two blank lines above this. |
chipx86 | |
Two blank lines. |
chipx86 | |
If we're not providing any sort of default arguments, no need for the {} param to RequestContext. |
chipx86 | |
Should only be indented 4 spaces. |
chipx86 | |
Two blank lines. |
chipx86 | |
Single quotes are fine. |
chipx86 | |
Either one line, or indent the value by 4 spaces. |
chipx86 |
-
-
-
-
-
I'm not a huge fan of this approach to looping. Maybe use an iterator here? iterator = (word.capitalize() for word in string.split(" ")) and then get words using iterator.next() This is simply an opinion, and not a correctness issue.
-
-
-
-
This could be: if string: Since None and the empty string have the same boolean value of False in Python.
-
-
-
-
-
-
-
-
I'm not sure what's going on here with the template tags: {{'{%'}} Is there a reason you're doing it this way rather than {% statement %}?
-
-
-
These could be on the same line. Also, it seems that there's an extra single space before "To do..." "To do..." can also be placed in a trans block.
-
-
-
- Change Summary:
-
I've implemented the suggested changes, and: - tried to make the strings used in the testing self-explanatory - modified LowerCaseWithUnderscores().formatted(string) to use a singular regular expression
- Diff:
-
Revision 3 (+342 -1)
-
-
-
It might be a bit unclear (should I add a '.template' suffix to these files?), but this uses Jinja. The dashes suppress whitespace.
-
It seems the suggested idiom for calling a superconstructor is to use something like super(ExtensionURLHook, self).__init__(arg1) (it's also used a few times in the reviewboard code)
-
Yes. This is because otherwise Jinja will interpret it as Jinja templating rather than raw text: http://jinja.pocoo.org/docs/templates/#escaping
-
-
The line above it already ended with a comma. It always looked like an error to me but I can see the sense in keeping it as it allows you to easily add and remove individual lines anywhere in the list without worrying about commas.
- Change Summary:
-
Just updating the review groups to include rbtools.
- Groups:
-
Anthony: This is looking really good! Just a few issues below. Thanks for your work, -Mike
-
-
I wonder if it'd be clearer if the flow for the unrecognized input case was as follows: 1) Ask the user the question 2) User answers with something invalid 3) Tell the user that their input was unrecognized 4) Go to (1) This way, it's clearer what question the user is being asked to answer.
-
-
If I supply no arguments, I get: incorrect number of arguments Traceback (most recent call last): File "/usr/local/bin/rb_extgen", line 9, in <module> load_entry_point('RBTools==0.4alpha0.dev', 'console_scripts', 'rb_extgen')() File "/media/Projects/rbtools/rbtools/rb_extgen.py", line 157, in main parse_options() File "/media/Projects/rbtools/rbtools/rb_extgen.py", line 101, in parse_options options.extension_name = args[0] IndexError: list index out of range We should probably do something more helpful here, like display the help.
-
-
-
- Change Summary:
-
I added in some duplication with the add_template for views.py as it feels like it would be easier to manage them separately without hunting down the joint condition under which it might lie. The TemplateBuilder should deduplicate all the templates anyway. Otherwise, I implemented the suggestions from the code review and added documentation.
- Diff:
-
Revision 4 (+393 -1)
-
This doesn't belong in RBTools. RBTools is meant to be used to talk to a Review Board server, but not for developing. This might be better suited as something in reviewboard/contrib/. We could probably build a package out of it later, or move it out to its own module.
-
A bit of stuff here. Mostly style-related, which you'll get the hang of. Also some pythonisms.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
__init__ should take *args, **kwargs, and the super() should pass it. That allows us to expand down the road without breaking things.
-
The URLs should be indented only 4 spaces, and use the url() stuff. Also, two blank lines above this.
-
-
-
-
-
-